How to set commands output as a variable in a batch file

前端 未结 9 1270
我在风中等你
我在风中等你 2020-11-22 01:19

Is it possible to set a statement\'s output of a batch file to a variable, for example:

findstr testing > %VARIABLE%

echo %VARIABLE%
9条回答
  •  情歌与酒
    2020-11-22 01:50

    cd %windir%\system32\inetsrv
    
    @echo off
    
    for /F "tokens=* USEBACKQ" %%x in (      
            `appcmd list apppool /text:name`
           ) do (
                echo|set /p=  "%%x - " /text:name & appcmd.exe list apppool "%%x" /text:processModel.identityType
           )
    
    echo %date% & echo %time%
    
    pause
    

提交回复
热议问题