cml*_*ano 1 windows powershell batch-file
以下行在powershell 2.0中运行良好.
servermanagercmd.exe -query | Select-String "Application Server" -Context 0,13
Run Code Online (Sandbox Code Playgroud)
但是当我将它合并到我的批处理文件中时,它只会尝试运行第一部分,然后在获得Select-String时返回错误.有谁知道如何确保它读取整行?我在管道前尝试了^,但它仍然无法识别整行.
您正尝试使用来自cmd.exe的PowerShell内置命令之一,但这不起作用.但是,您可以从.bat文件执行PowerShell,传入要执行的命令:
powershell.exe -command "& { servermanagercmd.exe -query | Select-String 'Application Server' -Context 0,13 }"
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3098 次 |
最近记录: |