How to copy the folder,and get exit code

Dont use the cmd.exe command :like cmd.exe /c copy, xcopy,
How to copy the folder?

Why not use the cmd command ?
1.Sometimes called cmd.exe will fail ,or it is the system problem or patches, but exist。
2.Use the cmd command in the script, if not the last sentence Even if failed, exit code also does not have capture to the error code, the console displays status to completely still and exit code is 0 。

So is there any command to copy the folder, like “cmd.exe md" can use " folder create".

Thanks

==========================================================================

I think I met a bug,
1.There are multiple waithidden script ,

waithidden cmd.exe /c command…
xxxx
waithidden cmd.exe /c command…
xxxx
waithidden cmd.exe /c command…
xxxxxxx
The console will only report last waithidden state, no matter in front of the execution, Situation
is caused by many waithidden fails, the last waithidden success, and only when the console is also showed complete and exit code is 0 。

2.actionscript dos command
dos xcopy source-folder des-folder
Test a source directory does not exist , The client log shows Command succeeded.And there is no any exit code information 。
But using CMD :
waithidden cmd.exe /c xcopy source-folder des-folder
The client log shows:Command succeeded (Exit Code=4), Exit Code non-zero Said there is an error occurred ?

So now I don’t know what the script in the event of a fault can immediately inform the console,

Thanks

I think you are going to need first create a folder with same name in the remote location and then copy the files within that new folder.

For what I know, there is no a relevance sentence that copies a folder and its content.

Thank you for your reply

I think I met a bug,
1.There are multiple waithidden script ,

waithidden  cmd.exe /c  command.................
xxxx
waithidden  cmd.exe /c  command.................
xxxx
waithidden  cmd.exe /c  command.................
xxxxxxx

The console will only report last waithidden state, no matter in front of the execution, Situation
is caused by many waithidden fails, the last waithidden success, and only when the console is also showed complete and exit code is 0 。

2.actionscript dos command

Test a source directory does not exist , The client log shows Command succeeded.And there is no any exit code information 。
But using CMD :

The client log shows:Command succeeded (Exit Code=4), Exit Code non-zero Said there is an error occurred ?

So now I don’t know what the script in the event of a fault can immediately inform the console,

Thanks

@Aram @jgstew @strawgate
My this question, what do you think,
Thanks

There is no command for copying folder.

You should use cmd.exe – if it fails you should investigate why it’s failing.

Bill

thanks
Using cmd.exe will bring me back on the second floor of those problems

The exit code of 4 with the ‘waithidden cmd.exe’ appears to be the correct response for the given scenario where the source directory does not exist, and is coming from xcopy:

https://technet.microsoft.com/en-us/library/bb491035.aspx

“Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line.”

You should still be able to leverage this exit code within your actionscript for error handling with something like:

continue if {exit code of action = 0}

1 Like

Thanks,I’ll try the exit code

I think @Aram has the correct solution for checking the exit code from each waithidden command.

I’d note as well though, that the “copy” command is provided by the cmd.exe shell; but “xcopy.exe” is a standalone binary. You should be able to execute the xcopy command without spawning a cmd shell, if that makes it any easier…

waithidden xcopy.exe /y source destination

I’ve had strange behavior from the waithidden command, when the command line contains more than one set of doublequotes (like doublequoting both the source and destination). In those cases I use a ‘createfile’ or ‘appendfile’ to build a batch on the fly, and execute the batch file with waithidden.