# Can Mingw32/Msys run dos/cmd.exe executables without screwing up the arguments?

I'm trying to run growlnotify.exe from a Windows bash prompt. Recompiling it for mingw32 isn't a good option for me.

growlnotify works if I use it from the cmd prompt, but it fails (mostly) from the bash prompt. It only seems to be able to take a single argument, one without a switch (which is the notification message). If there is more than one argument, it fails silently. If there is a single switch and no other arguments, that switch is sent as the message.

I've managed to dig up some hints on Google that it has something to do with the way Windows doesn't provide a real tty, but no fixes. Is there any clever way to force this to work? Some way of escaping the arguments correctly such that it behaves as expected?

New information:

If I run it it with tripled slashes, the arguments are ignored. Whereas if I run it with what is the correct format in DOS, it fails silently.

Failure (also failes if I use //):

growlnotify /a:'Application Name' /n:'Notification Type' 'message goes here'


But this:

growlnotify ///a:'Application Name' ///n:'Notification Type' 'message goes here'


That one will send a notices with the 'message goes here', but as if I hadn't bothered to include the first two arguments. Single or double slashes though, it never sends a notice (as if I included no arguments at all).

Quadruple and quintuple slashes behave the same as triple slashes.

-
Try growlnotify.exe //a:Lync testmessage –  Maximus Feb 28 '13 at 0:11
@Maximus that also fails. I've tried escaping it with \/a: as well, and every combination of doubled and tripled slashes that there are. –  John O Mar 1 '13 at 14:56
Hum, you may check, what command line is passed to exe. Look in TaskManager or ProcessExplorer. What changes in cmdline was made by bash prompt? –  Maximus Mar 1 '13 at 21:07
@Maximus The exe exits nearly immediately, if it's showing up in Task Manager, I can't tell. –  John O Mar 1 '13 at 21:11

To escape the arguments such that dos executables can be used, you double the slashes, such as:

growlnotify //a:Application //t:Title "message here"


The reason it would fail for me was because somehow I wasn't using the same application name as I had when I started the day before (and as a different application it was unregistered, and Growl For Windows ignores unregistered notifications).

There are a few other tricks worth mentioning. In CMD, you can issue the statement like this:

growlnotify //a:App //t:"With Spaces" "message here"


The "With Spaces" bombs. I think msys/bash may be expanding the quotes, and then passing it in, such that the executable sees two arguments, //t:With and Spaces". The correct way to do that seems to be:

growlnotify //a:App //t:With\ Spaces "message here"


Also, if you pass in any filepaths, you'll still want to use DOS-style, which means slashes (since ultimately it's the DOS-like executable that will consume that). But those will be interpreted as escapes, which means they have to be doubled as well.

growlnotify //a:App //ai:C:\\path\\to\\icon.png "message here"


Hope this helps someone in the future.

-

Have you tried running "cmd.exe /c growlnotify.exe ..." from MinGW?

-
I have not, I will now. –  John O Feb 27 '13 at 22:37
This doesn't seem to work, I run it as cmd.exe /C "growlnotify.exe /a:Lync testmessage" but this just drops me to a cmd.exe prompt without doing anything. –  John O Feb 27 '13 at 22:40
Got this working with cmd //c [command]. In MSYS a command line argument of "/c" is interpreted as the C: drive, so to pass any argument beginning with a forward slash you need to use two forward slashes. Source‌​. –  c24w Jun 14 '13 at 10:27