Launching Windows Applications from CLI with correct path arguments #299

nfarrar opened this Issue Apr 14, 2015 · 3 comments


None yet

4 participants

nfarrar commented Apr 14, 2015

I didn't see information on launching windows applications from the CLI in the FAQ. The following solution here which worked perfectly. Maybe it should be added to the FAQ?

  1. mkdir -p $HOME/.local/bin
  2. add C:\Users\nfarrar\.local\bin to windows PATH environment variable
  3. add a stub shell script to launch the executable and pass arguments converted from cygwin paths to windows paths using cygpath command in C:\Users\nfarrar\.local\bin

A sample stub for sublime text:

#!/usr/bin/env bash
/cygdrive/c/Program\ Files/Sublime\ Text\ 3/subl.exe `cygpath -w $@` &

I've added a couple other stubs for other applications, seems to work in all cases so far. :)

jlupi commented Apr 15, 2015

thats useful, thanks, I'll add it.

The simplified version is to add the stubs to /usr/local/bin. In this case you do not need to add anything to the windows PATH.

I'll mention both possibilities.

@jlupi jlupi closed this Apr 21, 2015
pashazz commented Jul 23, 2015

I came up with more elegant solution.


# Copyright (C) 2002, Earnie Boyd
# This file is part of Minimal SYStem.
# File: start

cmd /c start $(cygpath -w "$@")
  1. Create this file and make it executable
  2. Use the abilities of Windows' start command by registering your applications as shown here. You can folow examples in your own registry
  3. add this to .zshrc:
    compdef '_files -g "*"' start

All done! You can either open a file in associated application or launch registered application via start command. Optionally, make aliases.

beelsr commented Aug 6, 2016

just found this searching out something else and haven't read more than a para or two of the readme...

is there a reason you don't want to use the cygwin-provided cygstart. It works just like start does in Windoze but doesn't spawn off a sub-shell or need to be back-grounded or require extra files or perms or whatever...

as an example of a one-liner function from my .bash_functions...

winx() { if [ -z $1 ]; then cygstart -o explorer.exe /e,$(cygpath -aw .); else local EPATH=$(cygpath -aw "$@"); cygstart -o explorer.exe /e,"$EPATH"; fi }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment