开发者

How to launch PowerShell script from the OS command line?

I have a PowerShell script for building my project files, and I'd like to have capability to run it from my file manager's command line (and, possibly, make a shortcut to this script so开发者_JAVA技巧 I can start build from my desktop)

Any way to do this?


If you're on PowerShell 2.0 use:

PowerShell.exe -File c:\users\john\myscript.ps1

If you're on 1.0 use:

PowerShell -Command "& {c:\users\john\myscript.ps1}"

Depending on what you do/load in your profile script you may also want to specify -NoProfile. Of course, if your script requires something that is loaded in your profile then don't use this parameter. Otherwise, it can speed up execution of your script a bit.


invoke-command -computername -scriptblock{param()} -ArgumentList

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜