b1ff Posted May 28, 2006 Share Posted May 28, 2006 Hi everybody, first of all: i'm new to this, so please be gentle :"> I'm trying to write a script that puts the content of "dir /b" to an array, but i can't figure out how exactly the syntax has to be when i'm using @Userprofiledir because it's got spaces whithin. I'm doing this with a detour over a file that is then read into the array. This is my code: #include <file.au3> #include <Array.au3> RUNWAIT(@COMSPEC & " /k dir "& @userprofiledir &" > c:\temp\userprofiles.log") DIM $userprofiles _FileReadToArray("C:\temp\userprofiles.log",$userprofiles) FILEDELETE("c:\temp\userprofiles.log") _ArrayDisplay($userprofiles, "lala") _ArrayPop($userprofiles) _ArrayReverse($userprofiles) _ArrayPop($userprofiles) _ArrayReverse($userprofiles) It keeps telling me that the file does not exist. Thanks in advance, b1ff Link to comment Share on other sites More sharing options...
BigDod Posted May 28, 2006 Share Posted May 28, 2006 If you use Beta version you can use _FileListToArray #Include <File.au3> #Include <Array.au3> $FileList=_FileListToArray(@userprofiledir) If (Not IsArray($FileList)) and (@Error=1) Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf _ArrayDisplay($FileList,"$FileList") Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
b1ff Posted May 28, 2006 Author Share Posted May 28, 2006 If you use Beta version you can use _FileListToArray #Include <File.au3> #Include <Array.au3> $FileList=_FileListToArray(@userprofiledir) If (Not IsArray($FileList)) and (@Error=1) Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf _ArrayDisplay($FileList,"$FileList") Great, thanks für the fast answer, I'll check that out. But anyway, how would the syntax be? Thanks, b1ff Link to comment Share on other sites More sharing options...
MHz Posted May 28, 2006 Share Posted May 28, 2006 RunWait(@COMSPEC & ' /k dir "' & @userprofiledir & '" > c:\temp\userprofiles.log') Link to comment Share on other sites More sharing options...
b1ff Posted May 28, 2006 Author Share Posted May 28, 2006 RunWait(@COMSPEC & ' /k dir "' & @userprofiledir & '" > c:\temp\userprofiles.log') Thx MHz, but this does not seem to work! RunWait(@COMSPEC & ' /k dir "' & @userprofiledir & '" > c:\temp\userprofiles.log' RunWait(@COMSPEC & ' /k dir "' & @userprofiledir & '^ ERROR ERROR: Error parsing function call Link to comment Share on other sites More sharing options...
MHz Posted May 28, 2006 Share Posted May 28, 2006 Does c:\temp exist? It fails for me as I do not have c:\temp. If I create c:\temp, then it works fine. Link to comment Share on other sites More sharing options...
b1ff Posted May 28, 2006 Author Share Posted May 28, 2006 Does c:\temp exist? It fails for me as I do not have c:\temp. If I create c:\temp, then it works fine.I duno't know what went wrong before, but it really seems to work now! THANKS!!c:\temp dir exist anyway. Link to comment Share on other sites More sharing options...
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