Last active
August 2, 2024 08:18
-
-
Save mlabrkic/ff158e69d475f58aded5de82f066002f to your computer and use it in GitHub Desktop.
aliases in windows Command shell (git clone, cd ...)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: alias_doskey.bat | |
:: 2022-02M-07 12:54:05 | |
:: aliases in windows Command shell | |
:: /Windows has two command-line shells: the Command shell and PowerShell./ | |
:: OS: Windows 10 | |
:: ("alias_doskey.bat" is called from "alias-prompt.lnk") | |
:: I put it in a folder in my Windows path (for example): | |
:: C:\UTILS\BATCH\alias-prompt.lnk | |
:: --------------------------------------------------------- | |
:: doskey | |
:: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/doskey#examples | |
:: By default, DOSKEY macros are only saved for the current session. | |
:: --------------------------------------------------------- | |
:: http://ss64.com/nt/doskey.html | |
:: Syntax | |
:: DOSKEY [options] [macroname=[text]] | |
:: | |
:: Key | |
:: macroname A short name for the macro. | |
:: text The commands you want to recall. | |
:: Advanced macro definitions: | |
:: $T If you put more than one command in a DOSKEY macro, use $T. | |
:: to separate them. Equivalent to & in a batch file. | |
:: | |
:: $1-$9 Parameters, equivalent to %1-%9 in a batch file. | |
:: $* This represents ALL the parameters $1-9 | |
:: Options: | |
:: /MACROFILE=filename Specify a file of macros to install | |
:: /MACROS Display all Doskey macros | |
:: /EXENAME=exename Specify an executable other than cmd.exe | |
:: /MACROS:exename Display all Doskey macros for the given executable | |
:: /MACROS:ALL Display all Doskey macros for all executables | |
:: /HISTORY Display all commands stored in memory. | |
:: | |
:: /REINSTALL Install a new copy of Doskey (clears the buffer). | |
:: ALT+F10 Clear macro definitions | |
:: To delete a macro called "cdnu", type: | |
:: doskey cdnu= | |
:: --------------------------------------------------------- | |
:: https://stackoverflow.com/questions/9738434/run-a-command-prompt-command-from-desktop-shortcut | |
:: Yes, make the shortcut's path | |
:: %comspec% /k <command> | |
:: (echo %comspec%) | |
:: where | |
:: %comspec% is the environment variable for cmd.exe's full path, | |
:: equivalent to C:\Windows\System32\cmd.exe on most (if not all) Windows installs | |
:: /k keeps the window open after the command has run, | |
:: this may be replaced with /c if you want the window to close once the command is finished running | |
:: <command> is the command you wish to run | |
:: --------------------------------------------------------- | |
:: https://stackoverflow.com/questions/20530996/aliases-in-windows-command-prompt?rq=1 | |
:: https://superuser.com/questions/560519/how-to-set-an-alias-in-windows-command-line | |
:: --------------------------------------------------------- | |
:: https://zwbetz.com/aliases-in-windows-command-prompt/ | |
:: Create "alias-prompt.lnk", | |
:: I put it in a folder in my Windows path (for example): | |
:: C:\UTILS\BATCH\ | |
:: 0) First, create a file to hold your aliases: | |
:: alias_doskey.bat | |
:: 1) Create a shortcut: | |
:: Right-click on your desktop (or elsewhere) to create a link („New Shortcut“). | |
:: Aka a .lnk file with an exceptionally well hidden extension. | |
:: --------------------------- | |
:: 2) "Type the Location of Item" ("Target"): | |
:: (%comspec% /k <command>) | |
:: (%windir%\system32\cmd.exe) | |
:: cmd /k "C:\UTILS\BATCH\alias_doskey.bat & dir /B" | |
:: --------------------------- | |
:: 3) Name shortcut. | |
:: let say... | |
:: alias-prompt | |
:: 4) Right Click on shortcut, chose Properties. | |
:: Start In: | |
:: C:\UTILS\ | |
:: --------------------------- | |
:: 5) Move the generated command prompt link, "alias-prompt.lnk" into a directory: | |
:: C:\UTILS\BATCH\ | |
:: Desktop, "alias-prompt.lnk", Right Click, Cut | |
:: File Explorer (Win-E), | |
:: C:\UTILS\BATCH\ | |
:: Paste | |
:: --------------------------- | |
:: 6) Here you go :-) | |
:: Run: Win-R, alias-prompt | |
:: "alias-prompt.lnk" | |
:: I put it in a folder in my Windows path: | |
:: C:\UTILS\BATCH\ | |
:: Now when you open command prompt from the shortcut, your aliases will be loaded. | |
:: --------------------------------------------------------- | |
:: Display all Doskey macros: | |
:: doskey /MACROS | |
:: --------------------------------------------------------- | |
:: cd /? | |
:: dir /? | |
:: dir /OGN | |
:: cmd /? | |
:: --------------------------------------------------------- | |
@echo off | |
:: Temporary system path at cmd startup | |
:: set PATH=%PATH%;C:\Program Files\7-Zip\;C:\Program Files\Windows Application Driver\ | |
:: set PATH=%PATH%;C:\Program Files\7-Zip\;C:\UTDEV\YWinAppDriver\ | |
:: set APPIUM_WAD_PATH="C:\UTDEV\YWinAppDriver\WinAppDriver.exe" | |
set PATH=%PATH%;C:\UTDEV\Appium-Inspector-windows-2023.12.2-x64\ | |
:: Add to path by command | |
:: DOSKEY add_python33=set PATH=%PATH%;"C:\Python33\" | |
:: --------------------------- | |
:: Common directories | |
doskey cdmd=cd %USERPROFILE%\Documents\$tdir /OGN $* | |
doskey cdnc=cd %USERPROFILE%\AppData\Local\nvim\$tdir /OGN $* | |
doskey cdnd=cd %USERPROFILE%\AppData\Local\nvim-data\$tdir /OGN $* | |
doskey cdut=cd C:\UTILS\$tdir /OGN $* | |
doskey cdde=cd C:\MB_DEV\$tdir /OGN $* | |
:: --------------------------- | |
:: Commands | |
doskey al=doskey /MACROS | |
:: DOSKEY alias=notepad %USERPROFILE%\Dropbox\alias.cmd | |
:: gcl https://github.com/jdhao/nvim-config | |
doskey gcl=git clone $* | |
doskey gs=git status | |
doskey ga=git add . | |
:: git commit -m "Initial setup of website" | |
:: gco "Initial setup of website" | |
doskey gco=git commit -m $* | |
:: doskey gpu=git push -u origin main | |
doskey gpu=git push | |
doskey gpl=git pull | |
:: --------------------------- | |
:: 7z x -mcp=852 TR_2023.zip | |
doskey 7ze=7z x -mcp=852 $1 | |
doskey wad=WinAppDriver | |
doskey ApIn="Appium Inspector.exe" | |
:: set NVIM_APPNAME="nvim-kickstart" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment