Wednesday, April 2, 2008

Redirecting the output of a command to a file: Windows/Dos

Output of a DOS command can be redirected to a text file by the following two options
c:\>Command >C:\abc.txt
This will over write the data in file
c:\>Command >>C:\abc.txt
This will append the output

Usage:
For example if you want to find/search something in the path or environment variables.It is difficult to observe the output displayed on the dos screen or traversing one-by-one graphically.
so better option is to redirect the output to a text file.
>set >C:\mypath.txt
Now it is easy search in the text file

No comments: