microbious Posted September 11, 2009 Share Posted September 11, 2009 am trying to copy some stuff using Xcopy.exe in system32 here is the code Run (@SystemDir & '\xcopy.exe /E "%ALLUSERSPROFILE%\folder\" "foldername\subfolder" /Y') both folders exist but nothing is copied i tried everything i could think of and this seems to be the correct command. xcopy window just pops and closes quick so i cant tell if it says any errors. If i put CMD instead of Xcopy, CMD window will pop and just stay open and do nothing as if no commands were given. I know that i could simply make batch file and paste xcopy.exe /E "%ALLUSERSPROFILE%\folder\" "foldername\subfolder" /Y into it and everything would work but i want this command to be executed in autoit becaus autoit sucks at file copy commands. I wish autoit could copy by date and have al those flags such as copy subfolders hidden files and by date and stuff Please help me out here guys Thanks in advance Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 11, 2009 Share Posted September 11, 2009 (edited) am trying to copy some stuff using Xcopy.exe in system32 here is the code Run (@SystemDir & '\xcopy.exe /E "%ALLUSERSPROFILE%\folder\" "foldername\subfolder" /Y') both folders exist but nothing is copied i tried everything i could think of and this seems to be the correct command. xcopy window just pops and closes quick so i cant tell if it says any errors. If i put CMD instead of Xcopy, CMD window will pop and just stay open and do nothing as if no commands were given. I know that i could simply make batch file and paste xcopy.exe /E "%ALLUSERSPROFILE%\folder\" "foldername\subfolder" /Y into it and everything would work but i want this command to be executed in autoit becaus autoit sucks at file copy commands. I wish autoit could copy by date and have al those flags such as copy subfolders hidden files and by date and stuff Please help me out here guys Thanks in advance I don't think your %ALLUSERSPROFILE% is being expanded. Either use Opt("ExpandEnvStrings", 1) to get your script to parse the environment variable from the string, or pass it to a CMD interpreter: RunWait(@ComSpec & ' /k xcopy.exe /E "%ALLUSERSPROFILE%\folder\" "foldername\subfolder" /Y', @TempDir) Notice the single quotes enclosing the literal double quotes. Once you test it, change "/k" to "/c" so the console window will close when finished. Edited September 11, 2009 by PsaltyDS 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 More sharing options...
microbious Posted September 11, 2009 Author Share Posted September 11, 2009 I don't think your %ALLUSERSPROFILE% is being expanded. Either use Opt("ExpandEnvStrings", 1) to get your script to parse the environment variable from the string, or pass it to a CMD interpreter: RunWait(@ComSpec & ' /k xcopy.exe /E "%ALLUSERSPROFILE%\folder\" "foldername\subfolder" /Y', @TempDir) Notice the single quotes enclosing the literal double quotes. Once you test it, change "/k" to "/c" so the console window will close when finished. thats allot i wonder why my example worked for regerit to export/import .reg files without any problems why do i need those /k or /c switches ? are those xcopy.exe switches or autoit related ? thanks Link to comment Share on other sites More sharing options...
hhzz Posted September 11, 2009 Share Posted September 11, 2009 why do i need those /k or /c switches ?are those xcopy.exe switches or autoit related ?Those switches are from Windows "Command.exe". /k keeps the console window open even after xcopy ends/c closes the console window after xcopy ends.See: Info about Command.EXE Link to comment Share on other sites More sharing options...
microbious Posted September 11, 2009 Author Share Posted September 11, 2009 thanks u guys helped me allot am still learning Do u guys know if autoit will have better file handling in the next release ? Am talking about those optional stuff xcopy can do such as copy or not hidden/read only/newly changed only switches man that would be awesome ))))))))) Link to comment Share on other sites More sharing options...
hhzz Posted September 11, 2009 Share Posted September 11, 2009 Do u guys know if autoit will have better file handling in the next release ?Am talking about those optional stuff xcopy can do such as copy or not hidden/read only/newly changed only switchesman that would be awesome )))))))))There are enough support in AutoIt to accomplish those... with combination of:FileGetAttrib , FileGetTime , and FileCopy (of course)Or better yet, you could create an UDF! Link to comment Share on other sites More sharing options...
microbious Posted September 11, 2009 Author Share Posted September 11, 2009 yeah i wish i knew how to do that Link to comment Share on other sites More sharing options...
microbious Posted September 13, 2009 Author Share Posted September 13, 2009 hey guys how about this ? http://www.autoitscript.com/forum/index.php?showtopic=102269 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