如何运行而不显示一个窗口PowerShell脚本? [英] How to run a PowerShell script without displaying a window?

查看:1322
本文介绍了如何运行而不显示一个窗口PowerShell脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这怎么可能运行 PowerShell中不显示窗口或任何其他标​​志,以用户的脚本?

How is it possible to run a PowerShell script without displaying a window or any other sign to the user?

在换句话说,脚本应该在后台悄悄运行,没有任何迹象给用户。

In other words, the script should run quietly in the background without any sign to the user.

一个答案不使用第三方组件附加题:)

Extra credit for an answer that does not use third party components :)

推荐答案

您可以像这样运行(但是这显示了一个窗口了一会儿):

You can either run it like this (but this shows a windows for a while):

PowerShell.exe -windowstyle hidden { your script.. }

您也可以使用一个辅助文件,我创建,以避免所谓的PsRun.exe窗口,正是这么做的。你可以下载源和EXE文件运行与WinForm的计划任务GUI在PowerShell中。我用它来预定任务。

编辑:马可·指出这-windowstyle参数仅适用于V2

Edited: as Marco noted this -windowstyle parameter is available only for V2.

这篇关于如何运行而不显示一个窗口PowerShell脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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