Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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)

share|improve this question
add comment

migrated from stackoverflow.com Nov 13 '11 at 17:14

This question came from our site for professional and enthusiast programmers.

1 Answer

Sounds to me like you already know how to "do this properly" - you're just too lazy to do it.

A work-around for some commands (it'll work in your particular use case, but not much further) would be to drop batch files into a folder that is already in %PATH%. So, instead of using a shortcut for "np" you would put the following in "np.bat":

"C:\Program Files (x86)\Notepad++\notepad++.exe" %1

Then, whenever you run np Filename.txt it should run Notepad++ and open Filename.txt. Remember to use quotes for filenames that include spaces.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.