Reputation: 2406
I am using Windows with Cygwin installed and have a bash script. Since Cygwin's implementation of the Unix cp
command/program is flawed for Windows on default installation (fails to preserve Windows permissions unless Cygwin is installed with certain flags), I would like to issue Windows' native copy
command from the bash script instead.
Is there a way for me to issue this (and possibly any generic Windows Command Prompt command) and be able to handle errors (say copy
fails due to UAC, file not found, network drive unreachable, etc.) from within the bash script?
Upvotes: 2
Views: 1109
Reputation: 9545
In Windows BAT :
copy "YourFile.xyz" "ToDestinationPath(.xyz)" && (
Echo Copy ==^> Success
) || (
Echo Copy ==^> Failed)
Upvotes: 1
Reputation: 2710
I don't have cygwin right now but one of the following should works
./test.bat params
cmd /c test.bat params
cmd /c copy /?
Remember the quotes/double quotes can be interpreted differently between cmd
and bash
.
Upvotes: 1