Its a two step process (initially):
- Create a Windows cmd prompt shortcut in Desktop: This can be easily done by Holding the Ctl Key and drag cmd window shortcut in Programs-> Accessories to Desktop. This will create a Shortcut.
- Now modify the shortcut to execute a batch file at the start: This can be done by adding /q/k BATCHFILENAME after cmd.exe in Properties of Shortcut. I hope you are ware how get the properties, Right-click the Shotcut and Choose "Properties" in the context Menu. After the change it will look something like this (In my case batch file is stored at C:\Sara\ and filename is alias.bat).
One this is done, you are All Set. you can now add the commands to executed in the batch file. Sample file shown below, its self explanatory. Few things to understand are we use doskey command to create alias, and $* is in similar spirit to Unix/GNU Linux $* - it means all the arguments. Lines starting with REM are comments.
alias.bat:
REM ---------------------------------
REM Create alias for cleartool as ct
doskey ct=cleatool $*
REM Create alias for explorer as e
doskey e=explorer $*
REM Create alias for notpad++ as np
doskey np="C:\Program Files (x86)\Notepad++\notepad++" $*
REM Change intial dir to C:\Sara\scripts
cd /d C:\Sara\scripts
REM ---------------------------------
Now the same bactch file can be used to accomplish other task at start-up of command winddow: last example demonstrates that use.

No comments:
Post a Comment