在全 GUI Powershell 脚本中隐藏空控制台窗口? [英] Hide empty console window in a all GUI Powershell script?

查看:42
本文介绍了在全 GUI Powershell 脚本中隐藏空控制台窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 WinForms GUI 制作了一个非常简单的 Powershell 脚本.一切都按预期工作,但是,当我使用 PowerShell 运行 .ps1 脚本时,首先会出现一个黑色的空控制台窗口,然后显示 GUI.

I have made a very simple Powershell script with WinForms GUI. Everything works as intended but, when I run the .ps1 script with PowerShell a black empty console window appears at first and then the GUI shows.

无论如何要让控制台窗口消失?

Anyway to make the console window dissapear?

最好的问候

推荐答案

我写了一个 关于这个主题的小文章(法语抱歉)一年前.

I wrote a small article on this subject (sorry in french) one year ago.

这是使用小型 VBS 脚本启动 PowerShell 隐藏窗口的常见解决方案(技巧在最后一个 ,0).

Here is the common solution using a small VBS script to start PowerShell hidding his window (the trick is in the last ,0).

Set Args = Wscript.Arguments
'MsgBox  "Chemin LDAP: " & Args(0)
'MsgBox  "Classe: " & Args(1)

Set objShell = CreateObject("Wscript.Shell")
objShell.Run "c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -nologo -Noninteractive -file c:\SlxRH\RhModif.ps1 " & chr(34) & Args(0) & chr(34) , 0

我还在一个名为 slxPShell2.EXE.

这篇关于在全 GUI Powershell 脚本中隐藏空控制台窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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