Jump to content
Sign in to follow this  
microbious

please help with command prompt

Recommended Posts

microbious

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
microbious

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

Share this post


Link to post
Share on other sites
hhzz

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

Share this post


Link to post
Share on other sites
microbious

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

Share this post


Link to post
Share on other sites
hhzz

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!

Share this post


Link to post
Share on other sites
microbious

hey guys how about this ?

http://www.autoitscript.com/forum/index.php?showtopic=102269

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.