本帖最后由 y6383289 于 2023-5-11 20:44 编辑
- @ECHO OFF
- setlocal enabledelayedexpansion
- call :Folder_Input "Folder" "输入目录"&& echo 输入目录=%输入目录%
- echo Folder=%Folder%
- echo 调试结束&&pause&&exit
-
-
- goto :eof
-
- ::**************************************************************
- :: 输入目录名称
- ::**************************************************************
- :Folder_Input
- Title ★★★★★ %~n0 %~2 ★★★★★
- for /f "delims=" %%a in ('mshta "about:<script>var Folder = new ActiveXObject("Shell.Application").BrowseForFolder(0, "选择文件夹", 64, 17);if (Folder != null) {Folder = Folder.items();Folder = Folder.item();Folder = Folder.Path;new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).Write(Folder);}close();</script>"') do (
- set Folder_temp="%%a"
- )
- set %~1=%Folder_temp%
- echo Folder_temp=%Folder_temp%
- if "%2" NEQ "" set %~2=No
- if "%~1" NEQ "" if "%2" NEQ "" set %~2=Yes
- Title ★★★★★ %~n0 ★★★★★
- goto :eof
复制代码 运行结果
屏蔽setlocal enabledelayedexpansion
输入目录=!输入目录!
Folder="C:\Intel"
调试结束
请按任意键继续. . .
setlocal enabledelayedexpansion
输入目录=Yes
Folder=
调试结束
请按任意键继续. . . |