Commands in XP



tiki2k
07-09-2005, 11:36 PM
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 Stanley
07-09-2005, 11:36 PM
tiki2k wrote:
> 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.

--
Shenan Stanley
MS-MVP
--

Rich Barry
07-09-2005, 11:36 PM
Go to Start>All Programs>Accessories>Command Prompt.
"tiki2k" <tiki2k@home.not> wrote in message
news:uw21%23nWXFHA.1148@tk2msftngp13.phx.gbl...
> 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
07-09-2005, 11:37 PM
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 Stanley <newshelper@gmail.com> wrote in message
news:#N3AR7WXFHA.228@TK2MSFTNGP12.phx.gbl...
> tiki2k wrote:
> > 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.
>
> --
> Shenan Stanley
> MS-MVP
> --
>
>

Shenan Stanley
07-09-2005, 11:37 PM
tiki2k wrote:
> 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 Stanley wrote:
> 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.

tiki2k wrote:
> 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.....)

--
Shenan Stanley
MS-MVP
--

Kevin Brunt (Fat B@stard)!!
07-09-2005, 11:38 PM
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.



tiki2k wrote:
>
> 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
07-09-2005, 11:38 PM
Thanks. But what if I just want to delete everything in Temp including
subdir w/o taking out "Temp" itself?

"Kevin Brunt (Fat B@stard)!!" <k.brunt@ccs.bbk.ac.uk> wrote in message
news:7375C8D0.9A17E5D1@ccs.bbk.ac.uk...
>
> 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.
>
>
>
> tiki2k wrote:
>>
>> 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
07-09-2005, 11:38 PM
"Shenan Stanley" <newshelper@gmail.com> wrote in message
news:OBElO8ZXFHA.616@TK2MSFTNGP12.phx.gbl...
> tiki2k wrote:
>> 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 Stanley wrote:
>> 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.
>
> tiki2k wrote:
>> 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.....)
>
> --
> Shenan Stanley
> MS-MVP
> --
>
"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\"

Shenan Stanley
07-09-2005, 11:38 PM
tiki2k wrote:
> 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 Stanley wrote:
> 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.

tiki2k wrote:
> 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 Stanley wrote:
> 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.....)

tiki2k wrote:
> "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 *.*...

--
Shenan Stanley
MS-MVP
--

Torgeir Bakken \(MVP\)
07-09-2005, 11:39 PM
tiki2k wrote:

> 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



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx


Commands in XP