Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is closely related to a solution to another question of mine: How to invoke Windows' gvim in a Windows environment from within Cygwin?

I've now found that giving explorer.exe 'C:\Program Files (x86)\Vim\vim73\gvim.exe' in the Cygwin command-line opens Windows' gVim in a Windows context properly. I've written a gvim function in my .bashrc that executes the above command when called without arguments. However, I'd like to know how I can pass on the arguments to the gVim if the function is called with arguments. Trying explorer.exe 'C:\Program Files (x86)\Vim\vim73\gvim.exe' D:\myfile.txt just opens Windows Explorer to the Libraries page, so this direct syntax doesn't work, but I'm unable to find what the correct way to pass these arguments is.
Googling only gives me the list of switches to explorer.exe but nothing about passing arguments to executables executed with explorer.exe.

Edit: Please note that I'm running this from Cygwin, and I've tried many of the more straightforward solutions before landing on using explorer.exe, as documented in the question linked at the top. cygstart and cmd.exe /c both leave remnants of the Cygwin environment within the opened gVim, which causes some issues as mentioned there.

share|improve this question
Did you try using start? I think its entire purpose in life is to do what you're trying to coax Explorer into doing. – Michael Kjörling Aug 11 '13 at 17:53
@MichaelKjörling I'm sorry, I don't understand, which start are you referring to? Cygwin doesn't seem to know a command called start, how do I use it? – sundar Aug 11 '13 at 17:58
Michael meant the start command from the Windows command-prompt. Obviously that’s not going to work from the cygwin command-prompt, but you should be able to make it work as I will demonstrate in a moment below… – Synetech Aug 11 '13 at 17:59
@Synetech Yes, that's the one. – Michael Kjörling Aug 11 '13 at 18:00
Try using just 'C:\Program Files (x86)\Vim\vim73\gvim.exe' D:\myfile.txt (i.e. leave off the explorer.exe. Alternatively, try cmd.exe 'C:\Program Files (x86)\Vim\vim73\gvim.exe' D:\myfile.txt. – martineau Aug 11 '13 at 18:17

You must log in to answer this question.

Browse other questions tagged .