问题
- I need to run an executable on multiple folders. Lets say the EXECUTABLE is called "example.exe".
- The group of folders are DATED sub-directories that use a scheme of 20140101-20141231. A year of dated sub-directories. 365 Folders in total.
- I usually run the command like:
d:\FOLDER1\FOLDER2\EXECUTABLES\example.exe /DATE 20140101
The problem w/ this method is that I am ONLY able to run this executable on ONE dated sub-directory or folder at a time...any help would be appreciated! Thanks!
回答1:
Directly from the prompt,
for /d %a in (d:\your\subdirectory\2014*) do d:\FOLDER1\FOLDER2\EXECUTABLES\example.exe /DATE %%~na
or
for /d %a in (d:\your\subdirectory\2014*) do call d:\FOLDER1\FOLDER2\EXECUTABLES\example.exe /DATE %%~na
or
for /d %a in (d:\your\subdirectory\2014*) do start /w "" d:\FOLDER1\FOLDER2\EXECUTABLES\example.exe /DATE %%~na
may suit.
(I've assumed you want the parameter following the /date switch to be the name of the directory; also 2014* assumes you want this to run on all directories named starting 2014.)
来源:https://stackoverflow.com/questions/30283066/how-do-you-run-an-executable-on-multiple-folders