Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > MSDOS Programmer > Re: A batch fil...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 4 Topic 403 of 494
Post > Topic >>

Re: A batch file question...

by Herbert Kleebauer <klee@[EMAIL PROTECTED] > Jun 8, 2006 at 09:47 PM

JoAnne wrote:

> Is it possible to write a line of code in a .bat file, one that would
> be in the LAST line of the file, and would cause the .bat file to
> DELETE itself as a "last step?"

How about using the delete command?

In Win2k/XP:

del %~f0

and in Win9x (works only if the batch is in the current
directory or invoked with the full file name but not if 
the batch is in a %PATH% directory):

if exist %0.bat del %0.bat
if exist %0 del  %0



NOTE: IF the batch is in a %PATH% directory and is invoked
only with the name (without the .bat) and there is a file
with the same name but without an extension in the current
directory, than this file is deleted!




 4 Posts in Topic:
A batch file question...
JoAnne <mwsoft@[EMAIL   2006-06-08 07:15:29 
Re: A batch file question...
Herbert Kleebauer <kle  2006-06-08 21:47:47 
Re: A batch file question...
Charles Dye <cdye@[EMA  2006-06-08 14:17:34 
Re: A batch file question...
Dr John Stockton <jrs@  2006-06-08 22:50:05 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 6:30:55 CDT 2008.