Skip to content

Instantly share code, notes, and snippets.

@itssoap
Created February 19, 2023 18:58
Show Gist options
  • Save itssoap/511c8c951b5b2cb87ff3af4e61bdfbf0 to your computer and use it in GitHub Desktop.
Save itssoap/511c8c951b5b2cb87ff3af4e61bdfbf0 to your computer and use it in GitHub Desktop.
An attempt to make simple aliases in Windows
@echo off
set temp1=
set temp2=
set _strings=%*
echo %_strings%
for /f "tokens=1 delims==" %%a in ("%_strings%") do (
set aliasname=%temp1%%%a
set temp1=%aliasname%
)
for /f "delims== tokens=1*" %%A in ("%_strings%") do (
set aliasvalue=%output2%%%B
set temp2=%aliasvalue%
)
echo %aliasname%
echo %aliasvalue%
echo @echo off > C:/alias/%aliasname%.bat
echo %aliasvalue% %%* >> C:/alias/%aliasname%.bat
@itssoap
Copy link
Author

itssoap commented Apr 2, 2023

  • Keep this .bat file in PATH
  • Make a folder named "alias" in your C:/ directory
  • To make a new alias, run alias ld=ls -ld
  • Execute ld and see if the new alias is made properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment