Batch FileRecently I wrote a post about using aliases in windows like you can in Linux/Unix. In that post it shows it can be done and how you can set up several commands to have shortcuts.
I have since then added a few more, but some of them are only for my little netbook at home, so I have enhanced the batch files script to check the hostname first.
So there are two functions now Specific and Generic, so if it is on my netbook at home, it runs the specific settings plus the general ones, and on other machine it will only use the generic settings. Again as I have this on dropbox and the use of environment variables I can still maintain just one script, but not have to load all settings on all machines.
Here is the script now
@echo off
REM The above command turns off the output for the script
REM Script Name : doskey.cmd
REM Author : Craig Richards
REM Created : 29th-March-2013
REM Last Modified : 26th April 2013
REM Version : 1.6
REM Modifications : 1.2 - CR - Added enable_wireless and disable_wireless
REM : 1.3 - CR - Added history alias so I can show the history for the session
REM : 1.4 - CR - Added a link to the whereis command file to use the utility
REM : 1.5 - CR - Added an alias to start and stop mysql server on notebook, and a shortcut to mysql, may remove and add it to my path
REM : 1.6 - CR - Totally changed the script, it now checks that if it running on my netbook, it sets a certain subset of aliases, if any other machine
REM : it just creates the generic aliases
REM Description : Create Aliases for dos screen
if %computername% EQU GEEKBOOK (
goto Specific
) else (
goto Generic
)
:Generic
DOSKEY ls=dir
DOSKEY clear=cls
DOSKEY history=DOSKEY /h
DOSKEY whereis="%scripts%"\batch\whereis.cmd $*
exit /B 1
REM MySQL Start and stopping
:Specific
DOSKEY start_mysql=net start MySQL56
DOSKEY stop_mysql=net stop MySQL56
DOSKEY mysql="c:\Program Files\MySQL\MySQL Server 5.6\bin\mysql"
DOSKEY enable_wireless=devcon enable *DEV_001C*
DOSKEY disable_wireless=devcon disable *DEV_001C*
goto Generic
exit /B 1
I am always interested in your thoughts so if you have any comments or feedback then please feel free to add any comments, or you can mail me here