开发者

Windows Command Line: Loop through every word in .txt, output it to newline in new .txt

开发者 https://www.devze.com 2023-03-24 23:33 出处:网络
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 throu

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
)
0

精彩评论

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