PowerShell“回显” [英] PowerShell "echo on"

查看:1039
本文介绍了PowerShell“回显”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是 http://serverfault.com/questions/102098/powershell-脚本显示命令运行。我认为在这里提出这个问题会更合适。

This is a duplicate of http://serverfault.com/questions/102098/powershell-script-showing-commands-run. I thought it would be more appropriate to ask this question here.

我正在玩PowerShell脚本,他们工作得很好。但是,我想知道是否有任何方式也显示所有运行的命令,就像你手动输入他们自己。这将类似于批处理文件中的echo on。我看了PowerShell命令行参数,cmdlet,但我没有发现任何明显的。

I am playing around with PowerShell scripts and they're working great. However, I am wondering if there is any way to also show all the commands that were run, just as if you were manually typing them in yourself. This would be similar to "echo on" in batch files. I looked at the PowerShell command-line arguments, the cmdlets, but I didn't find anything obvious.

推荐答案

没有捕获任何exe输出。这是一个显示塞。我讨厌说,但我发现这样做的最好的方法是:

Start-Transcript doesn't catch any exe output. That's a show stopper for me. I hate to say it but the best way I've found to do this is:

cmd /c powershell.exe -file c:\users\hillr\foo.ps1 > foo.log

捕获所有AFAICT。

This captures everything AFAICT.

这篇关于PowerShell“回显”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆