Skip to main content

IT - cygwin - Call DOS command

To execute a MS-DOS command from inside a cygwin BASH script:

  • use <<<
  • surround the entire command with quotes
  • any quotes inside the command has to be escaped (\")
  • any folder divider has to be escaped (\\)
  • mklink can only be used if the cygwin terminal is executed as Administrator

$ cmd <<< "mklink /D \"${cn:1:4}_${r//\\/_}\" \"F:\\TV\\all\\$(echo "${REPLY}")\""
  • using & allows to execute more than one MS-DOS command
$ cmd <<< "dir & dir" 

Comments

Popular posts from this blog

TV Series - The Brokenwood Mysteries [NZ] (2014) - Season 10

 

Movie - Sin City: A Dame to Kill For (2014)

 

Movies - Deadpool & Wolverine (2024)