【发布时间】:2013-12-27 13:56:57
【问题描述】:
当我们在 PowerShell 中运行以下命令时:
get-date | sc C:\temp\date.log
它使用当前日期创建 date.log 文件。
但是如果我们通过 CMD 运行同样的:
powershell get-date | sc C:\temp\date.log
它抱怨:
错误:无法识别的命令
DESCRIPTION: SC is a command line program used for communicating with the Service Control Manager and services. USAGE: sc <server> [command] [service name] <option1> <option2>...
显然,CMD 将用于 POSH 的管道与它自己的管道混淆了。
谁能告诉我如何让它通过 CMD 运行?
感谢期待。
【问题讨论】: