Jump to content

How can I produce a list of files in a directory?


Recommended Posts

I want create a list of files in a directory with something like:

C:\>dir >filelist.txt

When I attempt this using ShellExecute I get a message that Windows can't find dir.

Any suggestions?

There is no DIR.exe to run. The DIR command is "native to", or "embedded in" the command shell (i.e. CMD.exe). So for AutoIt to run an embedded command, you first run the shell:
Run(@ComSpec & " /c DIR C:\Temp1 > C:\Temp2.txt")

You can skip all that and get the list to an array with just _FileListToArray(). Check it out in the help file.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

If you wanted to do it that way..

Run(@ComSpec & " /c dir > file.txt")oÝ÷ Ø    趫Á¬²¢é¢pj{m¢ÚòËaÆ®¶­sb6æ6ÇVFRfÇC´fÆRæS2fwC°¢6æ6ÇVFRfÇC´'&æS2fwC° ¢b33c¶bÒôfÆTÆ7EFô'&gV÷C´3¢b3#µvæF÷w2gV÷C²ÂgV÷C²¢â¢gV÷C²Ã¥ô'&F7Æb33c¶b
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...