我该使用什么命令在程序结束时打开指定路径?
start "c:\Yaya\yoyo\"
无法工作
你可以尝试这样:
%SystemRoot%\explorer.exe "c:\Yaya\yoyo\"
启动命令需要在开头使用空引号
,因为它使用第一个双引号短语作为"窗口标题"
start "" "c:\Yaya\yoyo\"
explorer ...
选项。 - Cameron Tacklindexplorer c:/Yaya/yoyo
c:/Yaya/yoyo
will need quotes should the path contain spaces. explorer "c:/Yaya/yoyo"
- Stestart "" ...
选项。 - Cameron Tacklind这里有两个打开文件夹的例子,一个在当前目录打开文件夹,另一个在父级目录中选择文件夹后打开。
:: Open an Explorer window with the 'temp' folder displayed and its parent hidden:
Explorer.exe /e,/root,"%temp%"
:: This one will open the parent directory and automatically select the 'temp' folder:
Explorer.exe /select,"%temp%"
:: See more examples here: https://ss64.com/nt/explorer.html
打开记事本并输入
START C:\Yaya\yoyo\
保存为:filename.BAT
编辑:有些人报告在START关键字后面有一个字符串,将路径用双引号括起来更好,因为路径中可能会包含带有空格的文件/文件夹名称。
START "" "C:\Yaya\yoyo\"
START "title" [/D path] [options] "command" [parameters]
其中
""
,就像 @foxidrives 的答案一样。 - Ste方法一
start "" "your directory or File"
eg:-
start "" "E:\Code SAmple\"
方法2
%SystemRoot%\explorer.exe "your directory or File"
eg:-
%SystemRoot%\explorer.exe "E:\Code SAmple\"
Reference:-