Hello,

I'm trying to create a batch file that will delete & remake temporary directories, but it isn't working. There are two directories that I want to do this two, and the second one doesn't work. here is the code:

@echo off
rd c:\windows\TEMP /s /q
md C:\windows\TEMP

rd C:\Documents and Settings\christ\Local Settings\Temp /s /q
md C:\Documents and Settings\christ\Local Settings\Temp

Are the spaces in the directory the problem? If so, how do i fix it?

Thanks,
Chris

Member Avatar for iamthwee

yes, use quotes

This will work as long as the TEMP dir is empty or it is not locked by another process.
Any solution for such scenario? I have "BITxx" files (where xx are random digits) that keep multiplying and growing in the TEMP dir. I can delete ALL of them except for ONE. Once I do that, I see more files being recreated. Please advise.

Hello,

I'm trying to create a batch file that will delete & remake temporary directories, but it isn't working. There are two directories that I want to do this two, and the second one doesn't work. here is the code:

@echo off
rd c:\windows\TEMP /s /q
md C:\windows\TEMP

rd C:\Documents and Settings\christ\Local Settings\Temp /s /q
md C:\Documents and Settings\christ\Local Settings\Temp

Are the spaces in the directory the problem? If so, how do i fix it?

Thanks,
Chris

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.