Help with batch file please

  skidzy 18:32 21 May 07
Locked

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 07

Try %userprofile% instead of %username%

  skidzy 19:11 21 May 07

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 ideas....fire away.

  MAJ 19:26 21 May 07

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 07

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 07

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 07

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

  Eric10 19:34 21 May 07

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:

C:
cd \Users\%username%\AppData\Local

  MAJ 19:40 21 May 07

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

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

  skidzy 19:42 21 May 07

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 07

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

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

Surface Pro 5 News - release date, UK price, features, specs

Gear VR vs. Daydream: Which delivers the best VR experience?

iPad Pro 12.9 vs Surface Pro 5