tazdev 1 Posted January 25, 2005 (edited) I totally do not understand how to use @comspec. I am trying to get a listing of the My Documents directory and have that placed into c:\temp.txt In dos I would type cd\documents and settings\myprofile\my documents dir *.* /s /b>c:\temp.txt That would make a temp file with the files listed. Why doesn't the below work? All I get is an empty file. $filedir = (@MyDocumentsDir & "\*.* /s /b>c:\temp.txt") Runwait(@comspec & " /c " & "dir " & $filedir) Edited January 25, 2005 by tazdev Share this post Link to post Share on other sites
Marc 36 Posted January 25, 2005 Try this one: $filedir = ('"' & @MyDocumentsDir & '"' & "\*.* /s /b>c:\temp.txt") Runwait(@comspec & " /c " & "dir " & $filedir) Good old DOS Box does not like long path names, especially ones containing spaces... to avoid this problem, you should embrace the path with " and you're done. It's my job to comfort the disturbed and to disturb the comfortable. My Projects: Profiler, MakeSFX, UserInfo, Simple Robocopy Progressbar Share this post Link to post Share on other sites
MHz 80 Posted January 25, 2005 $filedir = '"' & @MyDocumentsDir & '\*.*" /s /b>c:\temp.txt' Runwait(@comspec & " /c " & "dir " & $filedir) Notice the use of single quotes, as to double quotes. Your Dos equivalent requires quotes also, when spaces are within the address. Share this post Link to post Share on other sites
tazdev 1 Posted January 25, 2005 I will be the first to say it DUH Thanks Share this post Link to post Share on other sites
SlimShady 1 Posted January 25, 2005 ;Example 1 $filedir = @MyDocumentsDir RunWait(@ComSpec & " /c DIR *.* /S /B>c:\temp.txt", $filedir) ;Example 2 RunWait(@ComSpec & " /c DIR *.* /S /B>c:\temp.txt", @MyDocumentsDir) ;Example 3 RunWait(@ComSpec & ' /c DIR "' & @MyDocumentsDir & '" /S /B>c:\temp.txt') Share this post Link to post Share on other sites