Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用批处理脚本,我想获得由空格分隔的行的第一个标记。这可以在没有 for 循环的情况下完成吗?
example input: a b c d example output: a
谢谢。
CALL使用如下命令将文本作为批处理参数传递:
CALL
@echo off setlocal set text=a b c d set result= call :getFirstParam %text% echo %result% goto :eof :getFirstParam set result=%1 goto :eof
您可以这样使用 AWK:
awk '{print $1}' <your_file>