可以说我有以下几点:
$a = 1.1.1.1
cmd / C“模式con:cols = 55行= 10 &&标题Google && ping 1.1.1.1 -t”
我需要能够从Powershell打开cmd窗口并将其传递给 "cmd /C "mode con:cols=55 lines=10 && title Google && ping 1.1.1.1 -t""
但是我也希望能够将传递的命令中的IP地址替换为这样的变量 cmd /C "mode con:cols=55 lines=10 && title Google && ping " + $a + " -t"
我将不胜感激任何帮助。
只需使用Start-Process
命令行开关并根据需要构建参数字符串即可:
start-process cmd -ArgumentList "/C","mode con:cols=55 lines=10 && title Google && ping $a -t"
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句