Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to output the dir c:/[x:x etc list into a text file as well with the following code DIR >"Input Data".txt

The above works but it doesn't display exactly what is output onto command prompt screen. It includes all files and directories in the root of c: drive.

Any help would be greatly appreciated! :)

CD  c:\
DIR  C:/D/A:H-D/L
ECHO.
DIR  >"Input Data".txt
ECHO.
MOVE c:/"Input Data".txt c:/"My Batch Script File Assignment"/"Input"/
share|improve this question
    
Can you post the entire line you are putting in? As well, what OS you are using? –  Canadian Luke Sep 5 '12 at 5:53
    
CD c:\ DIR C:/D/A:H-D/L DIR >"Input Data".txt –  Jane Sep 5 '12 at 5:55
    
windows 7 64-bit –  Jane Sep 5 '12 at 5:55
    
Click on the edit button and add that information to the question –  Canadian Luke Sep 5 '12 at 5:56
    
I put it in the main part so it's easier to read :) –  Jane Sep 5 '12 at 5:56

1 Answer 1

up vote 0 down vote accepted
  1. You do know that Windows 7 uses \ instead of / like *nix operating systems?
  2. Try putting a space between each switch in line 2 (i.e. DIR C: /D /A:H-D /L)
  3. The DIR command two lines down that pipes out to the file is just using the default DIR, which includes non-hidden non-system files and folders in the current folder. Add the >"Input Data".txt after the command in line 2
share|improve this answer
    
Really? I was wondering what the difference was between / and \ so thanks! So just to be clear; while working on windows 7 I have to use /? I'll try out your suggestion now :) –  Jane Sep 5 '12 at 6:04
    
On Windows, / means a switch or argument; \ is a path seperator –  Canadian Luke Sep 5 '12 at 6:05
    
Progress! It's outputting hidden files only into the txt file, it's not displaying on the cmd window but that can be fixed with adding another DIR C: /D /A:H-D /L above. Thanks for your help! –  Jane Sep 5 '12 at 6:13
    
No problem. If it solves your problem, feel free to upvote once you get 15 rep:) –  Canadian Luke Sep 5 '12 at 6:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.