3

Possible Duplicate:
Running programs by typing some alias in Windows

Right now I have Notepad++ (or any other app) in my PATH and can fire it up from the CMD by typing notepad++ < filename > - which is fine. But I'd like to use it like npp < filename > as it's faster and less typing.

Can this be done?

5 Answers5

7

One solution is to create in the notepad++ directory (or anywhere else in the path) a file called npp.bat that contains the following line :

@echo off
"C:\Program Files\Notepad++\notepad++.exe" %*

change the above directory, if notepad++ is installed in another directory.

To launch notepad++ without cmd waiting :

@echo off
start "" "C:\Program Files\Notepad++\notepad++.exe" %*
harrymc
  • 498,455
4

One last idea:

The "doskey" utility, available at the NT command line, provides a facility called "macro", which allows you to specify aliases for the command line without having to change your search path or write a batch file for each EXE file you are interested in. Doskey also provides command-line history for old versions of DOS.

Microsoft provides doskey, so you know that it will be on any system you need to use. Doskey has been shipping with Windows (and, before that, MS-DOS) since something like the mid 1990s.

You need to run a command like this once:

doskey /macrofile="c:\somewhere\doskey.macros.txt"

The doskey.macros.txt is a plain text file that has a kind of "alias = command" format, with one alias per line. It looks something like this, with some "unix-like" aliases that I used to use, including the one for npp:

ls = dir $1
mv = move $*
cp = copy $*
cat = type $*
pwd = cd
history = doskey /history
np = "c:\somewhere\notepad++\notepad++.exe" $*
2

Yes you can. Navigate over to C:\Program Files (x86)\Notepad++\ and copy and paste notepad++.exe into the same directory. Now rename the copy to npp.exe. If the directory is in the PATH, you should be able to use npp as you described.

James T
  • 10,351
  • 4
  • 30
  • 31
1

You can also create a shortcut to the notepad++.exe file, call it (the shortcut) "npp" and put the location of the shortcut onto your path.

This makes a less verbose alternative to the other answer (creating a bat script for each program you want to do this sort of thing with).

TZHX
  • 245
0

This question again? The same answers were given on a question just a few days ago. I can remember.

But here, mklink, this will make a junction, a symlink:

mklink "C:\Program Files\Notepad++\npp.exe" "C:\Program Files\Notepad++\notepad++.exe"
sinni800
  • 3,169