2

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?

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

In Windows BAT :

copy "YourFile.xyz" "ToDestinationPath(.xyz)" && ( Echo Copy ==^> Success ) || ( Echo Copy ==^> Failed) 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.