clink.bat 1.5 KB

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