开发者

Trying to process files using a Batch. No output, Nothing happens

I'm trying to pass files one by one(I have to dot that since executable only accepts one file at a time). So, in my batch I have follwoing:

FOR /F %file IN ('dir /b /s *.css') DO CALL myExecutable.exe %file 

I should see out files in same directory but nothing happens, no errors are displayed either开发者_如何学C. Am I missing something here?


You have several mistakes in your example:

  • FOR parameter name is a single letter only
  • CALL is used to call another batch file or a subroutine in the existing batch file, not executables
  • the FOR parameter should be referenced with two %, when in batch file
  • you need to use a non-space delimiter, if the directory you run this command in or any subdirectory, or if any of the files has a space in the name

With these in mind, here's the right command you should be using:

for /f "usebackq delims=|" %%f in (`dir /b /s *.css`) do myexecutable.exe "%%f"

Here's my answer to a similar SO question, where I give more details on using FOR to process all files in a directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜