做一个bat文件,去批量执行当前文件夹下其他所有bat文件。怎么写代码?
3个回答
展开全部
不清楚你的实际文件/情况,仅以问题中的样例/说明为据;以下代码复制粘贴到记事本,另存为xx.bat,编码选ANSI
@echo off
rem 依次运行当前文件夹/目录里的其他bat
set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%@% %z%
cd /d "%~dp0"
>"%tmp%\v.v" echo;CreateObject("WScript.Shell").Run "cmd /c """ ^& WSH.Arguments(0) ^& """",1,True:WSH.Quit
for /f "delims=" %%a in ('dir /a-d/b *.bat') do (
if /i "%%~nxa" neq "%~nx0" (
echo;"%%a"
cscript -nologo -e:vbscript "%tmp%\v.v" "%%a"
)
)
echo;%#% +%$%%$%/%@% %z%
pause
exit
@echo off
rem 依次运行当前文件夹/目录里的其他bat
set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%@% %z%
cd /d "%~dp0"
>"%tmp%\v.v" echo;CreateObject("WScript.Shell").Run "cmd /c """ ^& WSH.Arguments(0) ^& """",1,True:WSH.Quit
for /f "delims=" %%a in ('dir /a-d/b *.bat') do (
if /i "%%~nxa" neq "%~nx0" (
echo;"%%a"
cscript -nologo -e:vbscript "%tmp%\v.v" "%%a"
)
)
echo;%#% +%$%%$%/%@% %z%
pause
exit
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询