如何通过cmd运行powershell命令。

如何通过cmd运行powershell命令。,powershell,cmd,Powershell,Cmd,这在CMD中非常有效: C:\>powershell.exe写入主机-前景红色“hello” 但我在运行此命令时遇到问题: C:\>powershell.exe[System.Net.Dns]::GetHostEntry(“192.168.1.100”) 我已经尝试添加-command选项,但仍然得到一个错误。 提前感谢。请尝试使用单引号中的地址 powershell.exe [System.Net.Dns]::GetHostEntry('192.168.1.100') 你能把错误贴出来吗?

这在CMD中非常有效:

C:\>powershell.exe写入主机-前景红色“hello”

但我在运行此命令时遇到问题:

C:\>powershell.exe[System.Net.Dns]::GetHostEntry(“192.168.1.100”)

我已经尝试添加-command选项,但仍然得到一个错误。
提前感谢。

请尝试使用单引号中的地址

powershell.exe [System.Net.Dns]::GetHostEntry('192.168.1.100')

你能把错误贴出来吗?