What I generally do is to create a folder like %USERPROFILE%/commands
, then I add that folder to the PATH
.
To change the “environment variables” for your account just search for “environment” on the start menu.
Then it’s simply a matter of creating *.bat
files with the desired names.
For instance you could save a ls.bat
file with just this content:
1 |
dir |
And you could save a ll.bat
file pointing to ls.bat
.
1 |
ls |
When you run it the output will be something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
c:\Users\wasteofserver\ll c:\Users\wasteofserver\ls c:\Users\wasteofserver\dir Volume in drive C is Windows Volume Serial NUmber is EEE-9999 Directory of c:\Users\wasteofserver 04/23/2020 06:08 PM <DIR> . 04/23/2020 06:08 PM <DIR> .. 04/23/2020 06:08 PM <DIR> folder 1 04/23/2020 06:08 PM <DIR> folder 2 0 files 0 bytes 2 Dir(s) 999,999,999,999 bytes free |
You could also save a home.bat
file that will change your directory to wherever you say “home” is. Any command you find yourself using repeatedly goes there.
Say, for instance, that you never know if it’s whereis
(linux) or where
(windows), just save yourself a whereis.bat
file on the commands
folder with the following:
1 |
where %1 |
And now, if you run it:
1 2 3 4 |
c:\Users\wasteofserver\whereis net c:\Users\wasteofserver\where net c:\Windows\System32\net.exe |
Presto! 😉