For /F with wmic unwanted output

前端 未结 4 1082
不思量自难忘°
不思量自难忘° 2020-12-04 03:40

First post here, so apologies if I don\'t do this quite right.

I\'m trying to output the OS version on a remote Windows PC, but I keep getting unwanted data. Execut

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 04:22

    Pipe it to the find command.

    @echo off
    set /p hostname=PC hostname?
    echo.
    FOR /F "tokens=1,2 delims==" %%A in ('wmic /node:%hostname% OS get caption /value ^|find /I "caption"') DO echo %%B
    echo.
    pause
    

提交回复
热议问题