How do you run an executable on multiple folders?

℡╲_俬逩灬. 提交于 2019-12-13 09:48:30

问题


  • 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!