Posted by SpywareDr on April 15, 2009 at 03:34:58:
In Reply to: Re: Direct a DOS command to a file where? posted by LL on April 14, 2009 at 11:29:23:
::: I want to direct the output of a DIR command to a
::: file (dir > dirlist1). Either it didn't work or I
::: don't know where it put the file. Does it create
::: a new file? If so, where does it put it?
:: Yes, that command creates a new file named
:: "dirlist1" in your current directory.
: Oh, it creates the file in the directory I was in when
: I entered the dir command. I get it now.
: Thanks.
You're welcome.
: But what if the file already exists? Does it wipe out
: the original file?
Yes, the command:
dir > dirlist1
(one greater-than symbol) will overwrite a file named "dirlist1" in the current directory. If "dirlist1" doesn't exist in the current directory, "dirlist1" will be created.
--
The command:
dir >> dirlist1
(two greater-than symbols) will append (add to) a file named "dirlist1" in the current directory. If "dirlist1" doesn't exist in the current directory, "dirlist1" will be created.