OSDN Git Service

Version 5.91
[vbslib/main.git] / scriptlib / BatchFiles / Switches.bat
diff --git a/scriptlib/BatchFiles/Switches.bat b/scriptlib/BatchFiles/Switches.bat
new file mode 100644 (file)
index 0000000..04984a3
--- /dev/null
@@ -0,0 +1,39 @@
+@echo off\r
+REM Character Encoding: "WHITE SQUARE" U+25A1 is □.\r
+REM Debugging path may be depended on code page of command prompt and this file.\r
+call :SetVariables "%~0"\r
+\r
+if     "%~1" == ""  %not_close%  %cscript% //nologo "%vbslib_root%\vbslib Prompt.vbs"  Switches  "C:\  .swit"  /g_debug_:1\r
+if not "%~1" == ""  %not_close%  %cscript% //nologo "%vbslib_root%\vbslib Prompt.vbs"  Switches  %1\r
+if not "%errorlevel%" == "21" ( pause )\r
+\r
+goto :eof\r
+\r
+\r
+REM ********************************************************************\r
+REM  Function: SetVariables\r
+REM ********************************************************************\r
+:SetVariables\r
+if     "%ProgramFiles(x86)%" == ""  set cscript=cscript\r
+if not "%ProgramFiles(x86)%" == ""  set cscript=%windir%\SysWOW64\cscript.exe\r
+\r
+set close_at_end=\r
+set not_close=cmd.exe /K\r
+\r
+call :GetParentPath "%~1"\r
+call :GetParentPath "%ret%"\r
+call :GetParentPath "%ret%"\r
+set vbslib_root=%ret%\r
+\r
+goto :eof\r
+\r
+\r
+REM ********************************************************************\r
+REM  Function: GetParentPath\r
+REM ********************************************************************\r
+:GetParentPath\r
+set ret=%~dp1\r
+set ret=%ret:~0,-1%\r
+goto :eof\r
+\r
+\r