I have a folder in a directory that contains 500 .exe files. At the moment, I use this code to go through the directory and run the .exe files:
echo file.exe
echo file.exe >>%LOGFILE%
&PATH&\file.exe /quiet /norestart
This is currently repeated 500 times with each file name.
I've had a look around online and found this: for /r %%i in (*) do echo %%i
So would this work? Or is there a better way?
for /r %%i in (*) do
echo file.exe
echo file.exe >>%LOGFILE%
&PATH&\file.exe /quiet /norestart
%%i
Could someone elaborate/explain? :)
The syntax is a bit off in some places, but yes, that should work sort-of:
for /r %%i in (*.exe) do (
echo %%~nxi
echo %%~nxi>>%LOGFILE%
"%%i" /quiet /norestart
)
%%~nxi
contains the name and extension of the current file in the loop
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.