![对于/f 仅显示第一个单词](https://linux22.com/image/1577752/%E5%AF%B9%E4%BA%8E%2Ff%20%E4%BB%85%E6%98%BE%E7%A4%BA%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%8D%95%E8%AF%8D.png)
所以我有一个 txt(infos.txt),其中 Infos 中有一句话:
echo This is a Sentence!
echo This is a Sentence in the 2nd line!
现在我用
for /f "skip=1" %%G IN (infos.txt) DO if not defined line set "line=%%G"
echo %line%
向我展示句子,但总是只有第一个单词。如果你能帮助我,那就太好了。感谢未来的回答。
答案1
所以,谢谢你的评论!我把它修复如下:
前:
for /f "skip=1" %%G IN (infos.txt) DO if not defined line set "line=%%G"
echo %line%
后:
for /f "skip=1 delims=" %%G IN (infos.txt) DO if not defined line set "line=%%G"
echo %line%
我刚刚添加了 delims=。
所以现在它向我显示整个句子并跳过第一行。