【问题标题】:Get multiple line response by executing command in batch file?通过在批处理文件中执行命令获得多行响应?
【发布时间】:2014-12-04 12:45:19
【问题描述】:

我正在批处理文件 (.bat) 中执行命令。 这个命令给了我一个多行响应,比如

Get String Return value = 1
[Name]
name=john

我想从这个输出中的变量中获取 john,但我不知道该怎么做。

提前致谢!!

【问题讨论】:

    标签: windows batch-file command-line scripting nsis


    【解决方案1】:
    @echo off
    for /f "tokens=1,* delims==" %%A in ('command ^| find /i "name="') do set "name=%%B"
    echo %name%
    

    ?

    【讨论】:

    • thanx npocmaka 但在我执行时显示 ECHO 已关闭。
    • 我的命令是 for /f "tokens=1,* delims==" %%A in ('call %confPath% GetIniString %datFile% Name name ^| find /i "name="' ) 设置 "name=%%B" echo %name%
    猜你喜欢
    • 2023-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多