执行批处理文件中的所有.reg文件 [英] executing all the .reg files from batch file
本文介绍了执行批处理文件中的所有.reg文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下脚本,该脚本执行当前目录中的所有.reg文件.问题是我在该文件夹中也有子目录,我也想执行这些reg文件.我不确定应该使用哪种开关.我尝试使用/s
返回驱动器的所有.reg文件.
I have following script that executes all the .reg files in the current directory. the problem is i also have sub directories in that folder and i want to execute those reg files as well. I am not sure what switch i am supposed to use. i tries using /s
which returns all the .reg files of the drive.
这是我的批处理文件的样子:
this is how my batch file looks like:
rem @echo off
cls
SET folder=%~dp0
for %%i in ("%folder%*.reg") do (regedit /s "%%i")
echo done
pause
EXIT
这是文件/目录结构的样子:
This is how file/directory structure looks like:
Folder1
batchfile.bat -> user double clicks or executes from command prompt
1.reg
2.reg
3.reg
Folder2
4.reg
5.reg
我在这里想念什么?
推荐答案
我认为您需要使用/R
开关的递归for
循环:
I think that you need a recursive for
loop using the /R
switch:
for /R "%folder%" %%i in (*.reg) do (regedit /s "%%i")
这篇关于执行批处理文件中的所有.reg文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文