Windows Command Line: Loop through every word in .txt, output it to newline in new .txt
I get the fee开发者_如何转开发ling this is a pretty simple issue but I'm relatively inexperienced with Windows command line hence the need to ask. In a batch file I'm writing, how would I loop through every separate word in a text file, and output that word to a new line in a new text file?
Thanks for any suggestions!
sounds like the uber-flexible and least-known-in-DOS FOR command is what you need something like:
FOR /f %%A in ('dir /b my_dir\*.csv ^| find /V "summary"') do (
rem do here what you want
)
see this stack question
EDIT: This shoudl work foe lines in a file. Eaither way... take a look at for. BTW MUCH easier in Powershell.
for /f "tokens=* delims= " %%a in (myfile) do (
echo do my commands on %%a
)
精彩评论