How do I open a file with a program via a shortcut from the cmd prompt

Posted by PassByReference0 on Super User See other posts from Super User or by PassByReference0
Published on 2011-11-13T16:52:44Z Indexed on 2011/11/13 17:56 UTC
Read the original article Hit count: 273

Filed under:
|

Here's my predicament:

When I add a program's location to my PATH, I can do the following in cmd prompt to open a file in my current directory:

notepad++ open_me.txt

And this opens open_me.txt in notepad++.

However, I don't want to have to add every single program I want to run to my path. What I want is to add a folder called C:\Users\Me\Documents\Programs to my path and just drop shortcuts to various programs into that folder and have them function the same as adding them to my path.

So I dropped a link to notepad++.exe named "np" in my folder, and what I got was this:

I have to run it with start np (instead of just np)

But more importantly, if I try start np open_me.txt, it opens notepad++.exe but looks for open_me.txt in notepad++'s directory.

How can I do this properly? (Also, I'd like to be opening notepad++.exe with the shortened name of np)

© Super User or respective owner

Related posts about batch

Related posts about command-line