Help with batch file please

  skidzy 18:32 21 May 2007

After some research of using a batch file to delete the temp files within Vista upon every startup im having problems running this from the command prompt.

Resulting in
The system cannot find the file specified.

First attempt was blocked with access denied,overcame this by disabling UAC.

The batch file in question:

cd C:\Users\%username%\AppData\Local
rmdir /S /Q Temp

Now do i change %username% to my user name ?
Though have tried and no success.

Maybe im doing it all wrong Lol.

All help and ideas greatly appreciated as always please.
Thankyou all.

  recap 19:02 21 May 2007

Try %userprofile% instead of %username%

  skidzy 19:11 21 May 2007

Cheers Recap

Sorry to say that does not work either,reported back as follows.

the filename,directory name,or volume label syntax is incorrect.

Though will try again,thankyou for the input and if any more away.

  MAJ 19:26 21 May 2007

I don't have Vista, skidzy, so I'm unfamiliar with it's directory structure, but try something like:

deltree C:\Users\%username%\AppData\Local\Temp

rmdir: removes only empty directories
deltree: removes directories that contain files.

  skidzy 19:30 21 May 2007

Cheers Maj

Here we go,the report:

deltree is not recognised as an external or internal command,operable program or batch file.

Again thankyou Maj,im really stumped.

  MAJ 19:33 21 May 2007

I forgot to say, seeing as you're doing this on startup you will need:

DELTREE /Y C:\Users\%username%\AppData\Local\Temp

The /Y switch will supress the confirmation prompt.

  MAJ 19:34 21 May 2007

Sorry skidzy, server error when I tried to post, so I didn't see your last post.

  Eric10 19:34 21 May 2007

Deltree had been dropped from XP so may not be in Vista either but your use of rmdir is correct according to the help files.

I think the problem is that you can't change the drive and folder in the one command. Instead use the following on two lines:

cd \Users\%username%\AppData\Local

  MAJ 19:40 21 May 2007

Or if Eric10's idea doesn't work, try

DEL /S /Q C:\Users\%username%\AppData\Local\Temp\*.*

  skidzy 19:42 21 May 2007

cheers Eric

Same ol thing,report as follows:

The system cannot find the specified file.

Thanks again,keep them coming all.

  skidzy 19:43 21 May 2007

do you mean as the first line or second line of command ?

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

The Evil Within 2 review-in-progress

Adobe shows still-in-development tools, including automatically colourising black-and-white photos

iPhone X news: Release date, price, new features & specs

Comment transformer un iPhone en borne Wi-Fi ?