Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bat file - How to delete question 1

Status
Not open for further replies.
Feb 1, 2005
144
0
0
US
Hi I am not very good at bat files, actually I do not know much about them.

Anyway I am installing java using a bat file.

The bat file contains 1 line:
java.exe

Which will simply install java on the machine by executing java.exe which is in the same directory as the execute.bat file.

My question is what do I need to include in the bat file to delete java.exe when the install is complete?

Is this possible?

Thanks a lot
 
That command alone might not work because it might try to execute the del java.exe command whilst the setup routine is still active and it will therefore fail because the file is still being accessed and it cannot delete it. I don't know how to get around this, maybe someone else does??

-----------------------------------------------------
"It's true, its damn true!"
-----------------------------------------------------
 
Are you using this batch file to install the java on more than one computer.?
 
I have taken care of the part how I am installing. using psexec.

i think del will work.
 
You could write a separate BAT file to del Java. The filename might be "JAVAdel.bat" and the contents would be:
del java.exe

You could elaborate by including the pathname along with the filename in the command, for example:
del "c:\temp\java.exe"



Carina Lister
Office of the City Prosecutor
City of Long Beach
carina_lister@longbeach.gov
 
yeah.. you may need to run it in 2 scripts.. 1 one week and maybe a week later run the cleanup script...

if you have a file server you can have all the clients run the java.exe off the server (so it would never need to be copied to each computer)

\\serverfs01\programfiles\java.exe


or something like that..
 
I looked a little further into it... they do have a program for batch files called choice.exe .. and its a no text yes/no question for dos.. BUT if you run the program with a /t you can do a timer with it. BUT.. I would go with the pull from the server or the 2 scripts because you dont know how long the java.exe is going to take on every workstation

if you want to download choice.exe I'd try google
 
Choice.exe is a Windows 98 thing, it will work on XP but you will have to copy it to the folder with your bat files are. Use .bat if in win98 and use a .cmd if useing XP. You can always use a pause in you bat file that will stop the bat execution and wait for a key to be pressed before going to the next comand.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top