to move about in directories
use the "CD" command
CD \pathname
ie.
the easiest method of getting a path into a batch file is to first go to the location with Windows Explorer
then copy the contents of the address bar to the notepad window containing the batch file
being created
To get into the Temp folder under your User Name
use the correct path for your version of the OS
ie. on Win2K / XP it's
C:\Documents and Settings\User name\Local Settings\Temp
and to go there from the command window or a batch file it's
CD "C:\Documents and Settings\User name\Local Settings\Temp"
the opening & closing " quotes are necessary because of the spaces in the directory names
a short 3 command batch file to kill all *.tmp files in the "Temp" directory would look like this
(insert the correct user name into the path first)
CD "C:\Documents and Settings\UserName\Local Settings\Temp"
attrib -r -h -s *.tmp
del *.tmp
run that batch
while windows explorer has that folder open and you'll see the files vanish
of course it will throw 2 errors if there are no *.tmp files
you could use the
if not exist *.tmp
to check for the files first and then jump if none are there
(insert the correct user name into the path first)
ie.
@Echo off
CD "C:\Documents and Settings\UserName\Local Settings\Temp"
if not exist *.tmp goto jump
attrib -r -h -s *.tmp
del *.tmp
goto end
:jump
echo.
echo no .tmp files found
echo.
:end