Jump to content

please help with command prompt


microbious
 Share

Recommended Posts

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 :D

Please help me out here guys

Thanks in advance

Link to comment
Share on other sites

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 :D

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.

:D

Edited 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

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.

:D

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

thanks u guys helped me allot

am still learning :D

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 :D)))))))))

Link to comment
Share on other sites

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 :D)))))))))

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...