Advertisement
Guest User

Batch Script For CMD Terminal Environment Aliases In Windows

a guest
May 6th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.12 KB | None | 0 0
  1. :: This install script does the following steps:
  2. :: 1) Creates following files in %USERPROFILE%\\dev\\:
  3. ::      - env.cmd
  4. ::      - regenv.reg
  5. :: 2) Runs regenv.reg
  6. ::
  7. :: The result is that everything in env.cmd is run automatically each time a CMD terminal session is opened.
  8. :: You can now add to env.cmd whatever aliases/quick commands (using doskey) you wish!
  9.  
  10.  
  11. mkdir %USERPROFILE%\\dev\\
  12.  
  13. @echo Creating 'env.cmd' file...
  14.  
  15. @echo off
  16. @echo @echo off > %USERPROFILE%\\dev\\env.cmd
  17. @echo doskey mci=mvn clean install -DskipTests >> %USERPROFILE%\\dev\\env.cmd
  18. @echo doskey mvn_versions=mvn versions:set -DnewVersion=$1 $T mvn versions:commit >> %USERPROFILE%\\dev\\env.cmd
  19.  
  20. @echo on
  21. @echo Creating 'regenv.reg' file...
  22. @echo off
  23.  
  24. @echo Windows Registry Editor Version 5.00 > %USERPROFILE%\\dev\\regenv.reg
  25. @echo [HKEY_CURRENT_USER\Software\Microsoft\Command Processor] >> %USERPROFILE%\\dev\\regenv.reg
  26. @echo "AutoRun"="%%USERPROFILE%%\\dev\\env.cmd" >> %USERPROFILE%\\dev\\regenv.reg
  27.  
  28. @echo on
  29. @echo Running 'regenv.reg' file...
  30. regedit.exe /s %USERPROFILE%\\dev\\regenv.reg
  31. @echo Env install finished successfuly !
  32. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement