, Windows XP SP3 x86, Windows 10 x64:
@if (@X)==(@Y) @end /* JScript comment
@echo off
rem A window title is needed so the appActivate function is
rem able to recognize the console window of this batch file.
title Open Folders
setlocal EnableExtensions EnableDelayedExpansion
:List
cls
echo Select from list.
echo.
echo 1) Postage
echo 2) Documents
echo 3) EXIT
echo.
set "Option="
set /p "Option=Enter the number: "
rem Prompt user once more if nothing entered.
if "!Option!" == "" goto List
rem Prompt user once more if entered string is not a positive
rem integer because it contains characters not being a digit.
for /F "delims=0123456789" %%N in ("!Option!") do goto List
rem Trim all leading zeros from number.
set "Number="
for /f "tokens=* delims=0" %%N in ("!Option!") do set "Number=%%N"
rem Prompt user once more if entered string is zero.
if "%Number%" == "" goto List
rem Prompt user once more if entered number is too large.
if %Number% GTR 3 goto List
rem Jump to appropriate option if not being the exit option.
if %Number% LSS 3 goto Opt%Number%
endlocal
exit /B
:Opt1
call :OpenDirectory "D:\Postage"
goto List
:Opt2
call :OpenDirectory "D:\documents"
goto List
rem This is a batch subroutine used for opening a folder with
rem Windows Explorer and getting the command prompt window
rem again back to top of all windows for next user input.
:OpenDirectory
if "%~1" == "" (
%SystemRoot%\explorer.exe
) else (
rem start "" "%~1"
%SystemRoot%\explorer.exe /e,"%~1"
)
rem The jscript part with the appActivate is called now
rem to make the command window again the top most window.
%SystemRoot%\System32\cscript.exe //E:JScript //nologo "%~f0"
rem This GOTO command ends the subroutine and results in continuing
rem batch processing on the line below the line called this routine.
goto :EOF
@if (@X)==(@Y) @end JScript comment */
var sh=new ActiveXObject("WScript.Shell");
WScript.Echo(sh.AppActivate("Open Folders"));
- - Bat , npocmaka.
Windows 10 x64. Windows, , , . , .
, ,
, , , EXIT.
, , , .
, , , script GOTO List.
. KB314853 Windows Windows Windows 95.
, start "" "%~1" , , . "" , , . start "%~1" . "" .
, , , , .
call /?cls /?echo /?endlocal /?exit /?for /?goto /?if /?rem /?set /?setlocal /?title /?
:
@echo off
rem A window title for better identifying what this cmd window is for.
title Open Folders
setlocal EnableExtensions EnableDelayedExpansion
:List
cls
echo Select from list.
echo.
echo 1) Postage
echo 2) Documents
echo 3) EXIT
echo.
set "Option="
set /p "Option=Enter the number: "
rem Prompt user once more if nothing entered.
if "!Option!" == "" goto List
rem Prompt user once more if entered string is not a positive
rem integer because it contains characters not being a digit.
for /F "delims=0123456789" %%N in ("!Option!") do goto List
rem Trim all leading zeros from number.
set "Number="
for /f "tokens=* delims=0" %%N in ("!Option!") do set "Number=%%N"
rem Prompt user once more if entered string is zero.
if "%Number%" == "" goto List
rem Prompt user once more if entered number is too large.
if %Number% GTR 3 goto List
rem Jump to appropriate option if not being the exit option.
if %Number% LSS 3 goto Opt%Number%
endlocal
exit /B
:Opt1
start "" /min "D:\Postage"
goto List
:Opt2
start "" /min "D:\documents"
goto List
, , . , , .
GUI . , , Windows,
start "" /min %SystemRoot%\explorer.exe /e,"%~1"
, , , , , , .