New*_*ion 7 filesystems batch-file
我有以下批处理命令来打开带dtd扩展名的文件.
REM Open all the static content files
"C:\Program Files (x86)\Notepad++\notepad++.exe" "D:\data\folder1\File1.dtd"
"C:\Program Files (x86)\Notepad++\notepad++.exe" "D:\data\folder1\File2.dtd"
"C:\Program Files (x86)\Notepad++\notepad++.exe" "D:\data\folder2\File1.dtd"
"C:\Program Files (x86)\Notepad++\notepad++.exe" "D:\data\folder2\File2.dtd"
"C:\Program Files (x86)\Notepad++\notepad++.exe" "D:\data\folder3\File1.dtd"
"C:\Program Files (x86)\Notepad++\notepad++.exe" "D:\data\folder3\File2.dtd"
Run Code Online (Sandbox Code Playgroud)
如何更改此批处理命令以打开文件夹dtd下具有扩展名的所有文件"D:\data"?
我尝试了下面的代码,但它不起作用
REM Open all the static content files
"C:\Program Files (x86)\Notepad++\notepad++.exe" "D:\data\\*.dtd"
Run Code Online (Sandbox Code Playgroud)
ren*_*ene 10
您可以使用以下FOR命令:
FOR /R [[drive:]path] %variable IN (set) DO command [command-parameters]遍历以[drive:]路径为根的目录树,在树的每个目录中执行FOR语句.如果在/ R之后没有指定目录规范,则假定当前目录.如果set只是一个句点(.)字符,那么它将枚举目录树.
在你的情况下,这应该工作:
FOR /R d:\data %a IN (*.dtd) DO "C:\Program Files (x86)\Notepad++\notepad++.exe" "%a"
Run Code Online (Sandbox Code Playgroud)
%%a如果需要从批处理文件中运行它,请使用
如果要使用多个扩展,可以使用空格分隔
FOR /R d:\data %a IN (*.dtd *.xml *.xslt) DO "C:\Program Files (x86)\Notepad++\notepad++.exe" "%a"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7683 次 |
| 最近记录: |