Aliases in Windows command prompt

后端 未结 16 2707
故里飘歌
故里飘歌 2020-11-22 10:47

I have added notepad++.exe to my Path in Environment variables.

Now in command prompt, notepad++.exe filename.txt opens the filename

16条回答
  •  时光取名叫无心
    2020-11-22 11:41

    Actually, I'll go you one better and let you in on a little technique that I've used since I used to program on an Amiga. On any new system you use, be it personal or professional, step one is to create two folders: C:\BIN and C:\BATCH. Then modify your path statement to put both at the start in the order C:\BATCH;C:\BIN;[rest of path].

    Having done that, if you have little out-of-the-way utilities that you need access to simply copy them to the C:\BIN folder and they're in your path. To temporarily override these assignments, you can add a batch file with the same name as the executable to the C:\BATCH folder and the path will find it before the file in C:\BIN. It should cover anything you might ever need to do.

    Of course, these days the canonical correct way to do this would be to create a symbolic junction to the file, but the same principle applies. There is a little extra added bonus as well. If you want to put something in the system that conflicts with something already in the path, putting it in the C:\BIN or C:\Batch folder will simply pre-empt the original - allowing you to override stuff either temporarily or permanently, or rename things to names you're more comfortable with - without actually altering the original.

提交回复
热议问题