3

On a Windows machine I want to avoid using cmd.exe at all cost. I'm trying to use babun (mintty 1.1.3) to run a batch file in a Windows folder.

This works:

{ ~ } » ./file.bat -o /path/to/files.xml

However, I would like to do something like:

{ ~ } » cd /path/to/  
{ ~ } » ./"c:\Program Files\App\file.bat" -o files.xml

However, all I get is zsh: no such file or directory:

I have tried sh, cmd /c and some other commands I've found, to no avail. I have also tried using a more linux-friendly path format, i.e. c:/Program\ Files/App/file.bat

I will be grateful for any help with this.

  • Are you sure UAC virtualization isn’t playing tricks on you and the file actually elsewhere? Because Linostar’s answer definitely works. – Daniel B Mar 12 '15 at 21:32
  • Thanks. No, I'm not sure. How can I check that? – msoutopico Mar 13 '15 at 7:10
5

Did you try removing the dot-slash ./ from the beginning of the path? A . means the current directory, and putting it before an absolute path, like the one you are using, usually makes no sense.

Try:

{ ~ } » "c:\Program Files\App\file.bat" -o files.xml

or

{ ~ } » "c:/Program Files/App/file.bat" -o files.xml

UPDATE:

or try using: "/cygdrive/c/Program Files/App/file.bat" -o files.xml

| improve this answer | |
  • Thanks, Linostar. Yes, that's the first thing I tried. The result is the message "zsh: command not found: C:\Program Files\App\file.bat" (for your former suggestion) or "The system cannot find the specified path" (for the latter). – msoutopico Mar 12 '15 at 20:32
  • What is the output of the pwd command in your zsh? That will give a good idea how your absolute paths should be written. – Linostar Mar 12 '15 at 20:55
  • Since it’s basically Cygwin on steroids, it can work with Windows paths, mostly. "G:/test.bat" works for me, including a correctly set working directory and whatnot. – Daniel B Mar 12 '15 at 21:30
  • Thanks, @Linostar: The output of pwd is /cygdrive/c/Users/Manuel/SkyDrive/path/to/files.xml. – msoutopico Mar 13 '15 at 7:06
  • I have tried putting a simpler test.bat (with no -o arguments) which just prints Hello World in the same folder where file.bat is, and that one works. So weird. – msoutopico Mar 13 '15 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.