Computer Hope

Microsoft => Microsoft DOS => Topic started by: Dias de verano on May 15, 2008, 02:13:03 PM

Title: 2 Handy Tips
Post by: Dias de verano on May 15, 2008, 02:13:03 PM
These are for Windows 2000/XP/Vista

Unlike PAUSE, which accepts any key, SET /P will only accept the Enter key.

Code: [Select]
SET /P =Press Enter to continue . . .
Group commands for redirection:
 
To log the result of several commands, a commonly used method is

Code: [Select]
command1 >  logfile.log
command2 >> logfile.log
command3 >> logfile.log

In Windows NT4/2000/XP command grouping can be used to simplify the code:

Code: [Select]
(
    command1
    command2
    command3
) > logfile.log
Title: Re: 2 Handy Tips
Post by: cryhelp on May 15, 2008, 02:44:11 PM
Thanks for the tips ;D
Title: Re: 2 Handy Tips
Post by: Carbon Dudeoxide on May 15, 2008, 07:09:04 PM
From my experience, you don't need to create the log file first.
Title: Re: 2 Handy Tips
Post by: Dias de verano on May 16, 2008, 12:17:35 AM
From my experience, you don't need to create the log file first.

Where did I say that you did? It depends (obviously) on what you want to do. If you want to create a new file each time, overwriting any other with the same name, then you would use the > symbol. If you want to create a file if it does not yet exist, OR add text to the end if it does already exist, you would use >>.


Title: Re: 2 Handy Tips
Post by: vibhor_agarwalin on May 16, 2008, 01:00:03 AM
Nice tips