clink.bat 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. :: Copyright (c) 2012 Martin Ridgers
  2. :: License: http://opensource.org/licenses/MIT
  3. @echo off
  4. set clink_profile_arg=
  5. set clink_quiet_arg=
  6. :: Mimic cmd.exe's behaviour when starting from the start menu.
  7. if /i "%1"=="startmenu" (
  8. cd /d "%userprofile%"
  9. shift /1
  10. )
  11. :: Check for the --profile option.
  12. if /i "%1"=="--profile" (
  13. set clink_profile_arg=--profile "%~2"
  14. shift /1
  15. shift /1
  16. )
  17. :: Check for the --quiet option.
  18. if /i "%1"=="--quiet" (
  19. set clink_quiet_arg= --quiet
  20. shift /1
  21. )
  22. :: If the .bat is run without any arguments, then start a cmd.exe instance.
  23. if "%1"=="" (
  24. call :launch
  25. goto :end
  26. )
  27. :: Pass through to appropriate loader.
  28. if /i "%processor_architecture%"=="x86" (
  29. "%~dp0\clink_x86.exe" %*
  30. ) else if /i "%processor_architecture%"=="amd64" (
  31. if defined processor_architew6432 (
  32. "%~dp0\clink_x86.exe" %*
  33. ) else (
  34. "%~dp0\clink_x64.exe" %*
  35. )
  36. )
  37. :end
  38. set clink_profile_arg=
  39. set clink_quiet_arg=
  40. goto :eof
  41. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  42. :launch
  43. start "Clink" cmd.exe /s /k ""%~dpnx0" inject %clink_profile_arg%%clink_quiet_arg%"
  44. exit /b 0