Batch script with for loop and pipe

前端 未结 4 466
小鲜肉
小鲜肉 2020-12-03 02:49

I would like all the csv files in a directory which filename does not contain word \"summary\". Inside the command prompt I can type the following command

di         


        
4条回答
  •  情歌与酒
    2020-12-03 03:28

    If you get the problem that Gilbeg got "find: /V': No such file or directory" then it's most likely you have cygwin, or similar, in your path and the batch file's not using the Windows find command. If you modify your script to use the absolute path of the Windows find then the error will go away:

    FOR /f "delims=" %%A in ('dir /b "my_dir\*.csv" ^| %SYSTEMROOT%\system32\find.exe /V "summary"') do (
    rem want to do something here with %%A
    )
    

提交回复
热议问题