Hiding a Powershell window using VBscript: whitespace in the -file filepath Hiding a Powershell window using VBscript: whitespace in the -file filepath powershell powershell

Hiding a Powershell window using VBscript: whitespace in the -file filepath


Thanks for the reference, here are two ways to start scripts with white space in the name :

1) using double " ("")

set Args = Wscript.ArgumentsMsgBox "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:\temp\test arg.ps1"" " & chr(34) & Args(0) & chr(34) , 0

2) Consist in writing your own PowerShell.exe with no console, as I explain at the end of this article ""PowerShell.exe" ne sait pas dĂ©marrer sans afficher une fenĂȘtre"(sorry in french)