used for saving aliases, setting enviroment variables, etc.
- linux:
/usr/<username>/config/cshrc.csh
- macOS:
/Users/<username>/.bash_profile
- create a
.bat
file with aliases commands, ie.aliases.bat
- in cmd, run
regedit
and go to:- before windows 10:
HKEY_CURRENT_USER\Software\Microsoft\Command Processor
- in windows 10:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor
- before windows 10:
- add
String Value
entry, with nameAutoRun
- set its value to full path of
aliases.bat
- variables:
NAME="potato"
,$NAME
,${NAME:6:7}
- arguments:
$[1-9]
$#
: number of arguments$*
: all arguments (list)
- comments:
#Comments
- options:
-o
- variables:
%VARIABLE%
- argument:
%<1-9>
- comments:
::
orRem
- switch:
/<a-z>
- other:
@
: apply command to itself, ie.@echo off
: to turn off display of commands>
: redirect output, ie.dir in > out
ls
: list contents of a directorycd
: change directoryexport
: sets script variablessetenv
: sets enviroment variablesecho
: prints in shellclear
: clear shellstart
: start a programmkdir
: make directoryprintenv
: display enviroment variablesalias
: sets aliasesman <cmd>
: prints Manual for<cmd>
dir
: list contents of a directorycd
: change directory,d:
: change driveset
: sets variables, or display enviroment variablesecho
: prints in shellcls
: clear shellstart
: start a programmd
: make directorypath
: display or sets %PATH% variablerem
: commentsdoskey
: sets aliases or macrospause
: pause shell from auto-close after successfully execute script
- c-shell:
alias <aliasname> '<command>'
- bash-shell:
alias <aliasname>='<command>'
doskey <aliasname>="command" $[1-9]
using command-line argv with doskey aliases (tricky one)
you have to tell the alias how many argument this doskey macro will have, doskey documentation
- in
aliases.bat
doskey aliases="file.bat" $1 $2 $3...
- in
file.bat
$[1-9]
=%[1-9]