Sign in to follow this  
Followers 0
Ices

Need some help, Yet Again

4 posts in this topic

#1 ·  Posted (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 by Ices

Share this post


Link to post
Share on other sites

#2 ·  Posted (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 by ezzetabi

Share this post


Link to post
Share on other sites

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


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

Thanks Much ezzetabi, it worked great. Im almost done with my program :idiot:

Share this post


Link to post
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
Sign in to follow this  
Followers 0