Launch Windows program from Cygwin

2

Is it possible to launch a Windows program from the Cygwin Shell? (similar to firing unix commands in PHP with "exec(…)")

My example: I'd like to launch a database backup in cygwin, however the mysqldump does not exist for cygwin. Therefore I need to fallback to the Windows version (c:\xampp\mysql\bin\mysqldump …). Is it possible to launch this from within Cygwin?

Bernd Plontsch

Posted 2011-06-03T14:49:22.633

Reputation: 211

Answers

3

Sure, just run it. The path is probably something like /cygdrive/c/xampp/mysql/bin/mysqldump. Just remember that any paths you pass TO mysqldump need to be in Windows (not cygwin) format. Or you can use the cygpath program to convert the paths for you.

Adam Batkin

Posted 2011-06-03T14:49:22.633

Reputation: 914

1

I found an answer from SO site useful.

Find ".bash_profile" file in your Cygwin installation path ( cygwin\home\user-name )

Put following lines in a file.

export desktop="desktop path"

alias chrome="cygstart C:/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe"

alias dbDump="c:/xampp/mysql/bin/mysqldump"

save and close the file.

NOTE: It is important to escape characters in path and path should be in POSIX format, not in windows format. start bash prompt. Execute

$chrome

This will open chrome window.
or

$dbDump

This will execute mysqldump program.

If you want to change present working directory to desktop then

$>cd $desktop

dkb

Posted 2011-06-03T14:49:22.633

Reputation: 111

1

I do it this way:

In .bashrc, add alias start='cmd /c start'

Then use the start command as needed.

start .

Open the current directory in Explorer

start winword log.txt

Open log.txt in Word

There's also "cygstart" that may also work for you.

melds

Posted 2011-06-03T14:49:22.633

Reputation: 181

2cygstart is the easiest, at least for launching windows explorer – Sridhar Sarnobat – 2018-11-08T18:00:12.363

1@SridharSarnobat In my current situation this comment of yours helped me more than any of the actual answers here. – mtraceur – 2019-07-03T18:55:56.783