Save the output of a powershell command in a variable and use it in batch script?

后端 未结 2 534
一生所求
一生所求 2021-01-04 14:04

What I am trying to do is to save the output of a powershell command (run from a batch script) and use it in the batch script.

Can you please advise me what to do?

2条回答
  •  执笔经年
    2021-01-04 14:44

    You can do this in batch using nslookup which does the same DNS-search:

    for /f "tokens=1*" %%a in ('nslookup hostname ^| findstr /i "name"') do set return=%%b
    echo Hello '%return%'
    

提交回复
热议问题