3

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"/
7
  • Can you post the entire line you are putting in? As well, what OS you are using? Commented Sep 5, 2012 at 5:53
  • CD c:\ DIR C:/D/A:H-D/L DIR >"Input Data".txt
    – Jane
    Commented Sep 5, 2012 at 5:55
  • windows 7 64-bit
    – Jane
    Commented Sep 5, 2012 at 5:55
  • Click on the edit button and add that information to the question Commented Sep 5, 2012 at 5:56
  • I put it in the main part so it's easier to read :)
    – Jane
    Commented Sep 5, 2012 at 5:56

1 Answer 1

0
  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
4
  • 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
    Commented Sep 5, 2012 at 6:04
  • On Windows, / means a switch or argument; \ is a path seperator Commented Sep 5, 2012 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
    Commented Sep 5, 2012 at 6:13
  • No problem. If it solves your problem, feel free to upvote once you get 15 rep:) Commented Sep 5, 2012 at 6:14

You must log in to answer this question.

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