我如何粘贴剪辑存储的数据并将其用于其他命令

我如何粘贴剪辑存储的数据并将其用于其他命令

我需要将 clip 命令的结果粘贴到 netsh 接口 ip 地址中

FOR /F "tokens=*" %%i in ('ipconfig ^| find "IPv4"') do SET result=%%i
echo %result:IPv4 Address. . . . . . . . . . . : =% | clip
netsh interface ip set address name="Local Area Connection" static %clip% 255.255.255.0 192.168.1.1

答案1

route change -p 0.0.0.0 mask 0.0.0.0 192.168.1.1

答案2

setlocal

FOR /F "tokens=*" %%i in ('ipconfig ^| find "IPv4"') do SET result=%%i
SET result=%result:IPv4 Address. . . . . . . . . . . : =%
echo %result% | clip
netsh interface ip set address name="Local Area Connection" static %result% 255.255.255.0 192.168.1.1

endlocal

相关内容