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!

Batch file problem

Status
Not open for further replies.

crossface

Programmer
Nov 30, 2002
81
0
0
US
I am getting an error using DEL, ERASE or RD in a batch file in Windows XP

Here is the syntax

RD /S/Q "C:\PROGRAM FILES\PALM" >NUL

DEL /S/Q "C:\PROGRAM FILES\PALM\*.*" >NUL

ERASE /S/Q "C:\PROGRAM FILES\PALM\*.*" >NUL


The error message I get is

Invalid Switch -/S

Works in 98, not XP

Any thoughts

Kevin Cotter
Byron Schools
 
donno why, maybe try to add spaces like such:

RD /S /Q "C:\PROGRAM FILES\PALM" >NUL

DEL /S /Q "C:\PROGRAM FILES\PALM\*.*" >NUL

ERASE /S /Q "C:\PROGRAM FILES\PALM\*.*" >NUL


I dont really understand why you are even try to 'del' and 'erase' the contents of the PALM directory because u already deleted and removed all files and subdirectories when u ran RD.
 
to get help on dos commands, type CMD in the run dialog, then type:- command /?

stiddy is right, rd removes all the files and directories from the palm directory, and including the palm directory itself.

Out of curiosity, why use a batch file? (batch files are only useful in pre-windows 2000/xp), when you can use windows to open c drive and locate the palm folder then highlight the folder then press the del key.
 
This is for a school where we want the PALM directory to go back to its original state at the end of the day. The idea here is to make it turnkey.

Kevin Cotter
Byron Schools
 
If i have read your post correctly you want a batch file that deletes the contents of the Palm directory, but leaves a blank Palm directory in place? If that is the case use the following:

Code:
RD /S /Q c:\"program files"\palm
MD c:\"Program files"\palm

The above code will remove the palm folder and then recreate it, this ensures that all hidden and read only files are also removed.

Greg Palmer
Free Software for Adminstrators
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top