Jump to content

Hide/Minimize the Powershell command console


 Share

Recommended Posts

I have  following .au3 compiled into  .exe.  on Win 10 PC.  I ran the .exe file

 

I do not want the powershell command pane to  show up. Though it comes, it goes right away. I have set the -option WindowStyle hidden. Any insights how it can be completely hidden 

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=C:\PS\samples\t10.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Local $sCommand = 'PowerShell.exe -WindowStyle Hidden'
$sCommand &= ' ; '
$sCommand &= 'Get-Process > C:\PS\samples\p1.txt'
Run($sCommand)

Link to comment
Share on other sites

This is what I use for launching Powershell scripts

$sPowerShell = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell", "Path")
    $sArguments = @TempDir & "\EWS\SendMail.ps1"
    
    $iPIDps = Run($sPowerShell & ' -ExecutionPolicy ByPass -File "' & $sArguments & '"', "", @SW_HIDE, 2)
    If @error Then  ConsoleWrite("Error encountered on Run" & @CRLF)
    ProcessWaitClose($iPIDps)
    $sOutRead = StdoutRead($iPIDps)
    Consolewrite("Results = " & $sOutRead & @CRLF)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...