Read stdin stream in a batch file

前端 未结 4 727
春和景丽
春和景丽 2020-11-27 17:05

Is it possible to use a piped stdin stream inside a batch file?

I want to be able to redirect the output of one command into my batch file process.bat l

4条回答
  •  情话喂你
    2020-11-27 17:46

    The set "line=!line:*:=!" syntax is:

    1. set requires one parameter that is a=b.
      If a contains a space or something, you'll have to use the quotation marks around this parameter. Here I don't see any

    2. !line:*:=!
      For this syntax, you can type 'set /?' to see the official description on using variables.
      !var! is like %var%, to get the value. But !var! means delayed expansion.

    line var name

    the first : variable modification mark.

    **:= **:=(empty), replace the string in the variable's value matches "*:"(virtually from the string start to first : occurence) with (empty), i.e. delete the substring from start to first colon.

提交回复
热议问题