0
 e:
 cd \My Files
 dir a:\ >\Prt2Txt\adrv1.txt\
 pause

results in:

 E:\My Files>nhm
 E:\My Files>e:
 E:\My Files>cd \My Files
 E:\My Files>dir a:\  1>\Prt2Txt\adrv1.txt\
 The system cannot find the path specified.
 E:\My Files>pause
 Press any key to continue . . .
  1. Where did the extra spaces come from?

  2. Where did the "1" come from?

I tried it with the full pathname "E:\My Files\..." , but the "My " seemed to be the problem.

1
  • cd "\My Files"
    – DavidPostill
    Commented Apr 14, 2019 at 13:17

2 Answers 2

1

I think the issue is you are trying to write the output of the dir command to a directory:

dir a:\ >\Prt2Txt\adrv1.txt\

should be

dir a:\ >\Prt2Txt\adrv1.txt

(No trailing slash.)

0

Not unlike Unix, Windows allows different I/O streams to be redirected places, so you can do

command args > fileA 2> fileB
to send standard output to fileA and standard error to fileB.  Standard output is file descriptor 1, so > is equivalent to 1>.  For some reason, when you run a batch file with ECHO ON, CMD displays > as  1>.  I guess this is meant to make things less ambiguous; as your question demonstrates, it seems to create more confusion than clarity.

The system cannot find the path specified. can mean either that A: or E:\Prt2Txt does not exist.  Try dir a:\ (without output redirection) and try e: followed by echo test >\Prt2Txt\adrv1.txt\; you’ll probably see that one (or both) of them fail.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .