Ices Posted January 4, 2005 Posted January 4, 2005 (edited) I want my script to open a command prompt, do a directory list, then make a text file, and copying the directory list to the text file. Opening the command prompt and making the text file I got, but how would I get the directory list from the command prompt to the text file? Any ideas? Also, if I can get a directory list without the use of a command line, I could do that instead, Im open to suggestions Edited January 4, 2005 by Ices
ezzetabi Posted January 4, 2005 Posted January 4, 2005 (edited) May help... $sDirectory = 'c:\';Put the directory name here $sOutPutFile = 'd:\test.txt';Put the output file name here If StringRight($sDirectory,1) <> '\' Then $sDirectory = $sDirectory & '\' $iHandle = FileFindFirstFile($sDirectory & '*.*') While $iHandle <> -1 $sFileName = FileFindNextFile($iHandle) If @error Then FileClose($iHandle) ExitLoop EndIf $sList = $sList & @CRLF & $sDirectory & $sFileName WEnd $sList = StringTrimLeft($sList,2);Remove the heading @crlf FileDelete($sOutPutFile) FileWrite($sOutPutFile,$sList) Edited January 4, 2005 by ezzetabi
buzz44 Posted January 4, 2005 Posted January 4, 2005 use this to run a hidden cmd window and get dir #include <Process.au3> _RunDos("Dir" & " > " & @TempDir & "\temp.txt") Change @TempDir & "\temp.txt", to the place you want to same the text file as, and also change "dir" by first opening the directory to get files/fodler of qq
Ices Posted January 4, 2005 Author Posted January 4, 2005 Thanks Much ezzetabi, it worked great. Im almost done with my program
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now