Commands in XP

  • Thread starter Thread starter tiki2k
  • Start date Start date
T

tiki2k

Someone showed me how to make a bat file using the del.exe command so that
when executed, it will automatically clears out my temp folder.
Can I do the same in W2K or XP? Where are those commands located?
 
tiki2k said:
Someone showed me how to make a bat file using the del.exe command so
that when executed, it will automatically clears out my temp folder.
Can I do the same in W2K or XP? Where are those commands located?

Yes, you can make scripts to do things for you.
The command line commands and their switches can be found....

Start --> Run -->
c:\windows\help\ntcmds.chm
OK.

And/Or

Command-line reference A-Z
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx
( Short Link: http://snipurl.com/7x9d )

Support WebCast: New Microsoft Windows XP Command-line Tools and
Troubleshooting Utilities
http://support.microsoft.com/kb/324617

When using a comman line command, you can always type " /?" after the
command and get some in-line help.
 
This is the command line in the bat file I had in Win98 to clear out my temp
files and folders:
C:\WINDOWS\COMMAND\DELTREE.EXE /y c:\windows\temp\

So I tried to modify the command a lil to WinXP which then reads:
del /q c:\documents and settings\my name\local settings\temp

Of course that didn't work.
 
tiki2k said:
Someone showed me how to make a bat file using the del.exe command
so that when executed, it will automatically clears out my temp
folder. Can I do the same in W2K or XP? Where are those commands
located?

Shenan said:
Yes, you can make scripts to do things for you.
The command line commands and their switches can be found....

Start --> Run -->
c:\windows\help\ntcmds.chm
OK.

And/Or

Command-line reference A-Z

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx
( Short Link: http://snipurl.com/7x9d )

Support WebCast: New Microsoft Windows XP Command-line Tools and
Troubleshooting Utilities
http://support.microsoft.com/kb/324617

When using a comman line command, you can always type " /?" after the
command and get some in-line help.
This is the command line in the bat file I had in Win98 to clear out
my temp files and folders:
C:\WINDOWS\COMMAND\DELTREE.EXE /y c:\windows\temp\

So I tried to modify the command a lil to WinXP which then reads:
del /q c:\documents and settings\my name\local settings\temp

Of course that didn't work.

The full path to the command-line command should not be necessary.
However, long path/filenames require quotes...

del /f /q /s "%USERPROFILE%\local settings\temp\*.*"

The above line in a batch script will delete all files in the your local
settings\temp directory (when you are logged in.)..

RMDIR /S /Q "%USERPROFILE%\local settings\temp\"

The above line in a batch script will delete all files/directories in the
your local settings\temp directory (when you are logged in.)..

(of course, it cannot delete in use files/directories with in-use files in
them.....)
 
WinXP does not have DELTREE command. You can use:

RD /S c:\TEMP

The above command should remove your temp folder and any files in it.
 
Thanks. But what if I just want to delete everything in Temp including
subdir w/o taking out "Temp" itself?
 
Shenan Stanley said:
The full path to the command-line command should not be necessary.
However, long path/filenames require quotes...

del /f /q /s "%USERPROFILE%\local settings\temp\*.*"

The above line in a batch script will delete all files in the your local
settings\temp directory (when you are logged in.)..

RMDIR /S /Q "%USERPROFILE%\local settings\temp\"

The above line in a batch script will delete all files/directories in the
your local settings\temp directory (when you are logged in.)..

(of course, it cannot delete in use files/directories with in-use files in
them.....)
"The system cannot find the path specified."
If I want to clear the temp folder of the Guest profile then is this what I
need to type?
del /f /q /s "%guest%\local settings\temp\"
 
tiki2k said:
Someone showed me how to make a bat file using the del.exe command
so that when executed, it will automatically clears out my temp
folder. Can I do the same in W2K or XP? Where are those commands
located?

Shenan said:
Yes, you can make scripts to do things for you.
The command line commands and their switches can be found....

Start --> Run -->
c:\windows\help\ntcmds.chm
OK.

And/Or

Command-line reference A-Z

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx
( Short Link: http://snipurl.com/7x9d )

Support WebCast: New Microsoft Windows XP Command-line Tools and
Troubleshooting Utilities
http://support.microsoft.com/kb/324617

When using a comman line command, you can always type " /?" after
the command and get some in-line help.
This is the command line in the bat file I had in Win98 to clear out
my temp files and folders:
C:\WINDOWS\COMMAND\DELTREE.EXE /y c:\windows\temp\

So I tried to modify the command a lil to WinXP which then reads:
del /q c:\documents and settings\my name\local settings\temp

Of course that didn't work.


Shenan said:
The full path to the command-line command should not be necessary.
However, long path/filenames require quotes...

del /f /q /s "%USERPROFILE%\local settings\temp\*.*"

The above line in a batch script will delete all files in the your
local settings\temp directory (when you are logged in.)..

RMDIR /S /Q "%USERPROFILE%\local settings\temp\"

The above line in a batch script will delete all files/directories
in the your local settings\temp directory (when you are logged in.)..

(of course, it cannot delete in use files/directories with in-use
files in them.....)
"The system cannot find the path specified."
If I want to clear the temp folder of the Guest profile then is this
what I need to type?

del /f /q /s "%guest%\local settings\temp\"

No.. For a list of Command Line Variables available when you are logged on
(again - when you are logged on) open a command prompt and type "SET" and
press ENTER.

That will list what you can use between the Percent signs in your scripts -
and it has to be within a .BAT or .CMD script.

Assuming you have a guest profile, and are not logged in as that user but
another user with administrative access, you will have to give the entire
path.. And when using DEL, you have to specify a filename at the end, thus
my *.*...
 
tiki2k said:
Thanks. But what if I just want to delete everything in Temp
including subdir w/o taking out "Temp" itself?
Hi,

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


DELTREE.BAT "c:\My Test Folder"

Deltree.bat contains:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top