Re: Batch File Help

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Olam wrote:

I still cannot get mine to work. This is what I have in my bat/cmd file
rmdir /S /Q "C:\Documents and Settings\Jeremy Johnston\Local Settings\Temp\*.*"
I get the following error at the cmd prompt
The filename, directory name, or volume label syntax is incorrect.


At first I had it deleting all the files in the temp but it left all of the sub directories. ???

Hi,

See tip 617 in the 'Tips & Tricks' at http://www.jsiinc.com/reghack.htm

DELTREE.BAT "c:\My Test Folder"

To delete files and sub directories under the temp folder:

DELTREE.BAT "%USERPROFILE%\Local Settings\Temp"


Deltree.bat contains:

@echo off
pushd %1
del /q *.*
for /f "Tokens=*" %%i in ('dir /B') do rd /s /q "%%i"
popd





--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
.



Relevant Pages