Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage Example #8

Open
yokhoe opened this issue Oct 3, 2023 · 3 comments
Open

Usage Example #8

yokhoe opened this issue Oct 3, 2023 · 3 comments

Comments

@yokhoe
Copy link

yokhoe commented Oct 3, 2023

Hello,
Sorry to be a complete newbie on this. How do you exactly use hiddenw.exe with arguments? I've tried something like the following: .\hiddenw.exe "Powershell -executionpolicy bypass -file .\Create-IntuneSystemtrayV2.ps1" only for the log to respond with "Unable to find target executable name in own executable name."

I was trying to find articles in regards to powershellw.exe or pwshw.exe but couldn't find a solid posting or article. I remember it being referenced a few times in the past, but it seems like the topic disappear from the entire internet. My powershell is essentially a system tray application that spits unnecessary information on the console that I would like to hide.
image

@SeidChr
Copy link
Owner

SeidChr commented Oct 3, 2023

Hey,

seems i may have not written the readme that well.

You are not supposed to use hiddenw.exe as is!

You rename it to the tool-name you want to execute without a window, and put it next to that other file.

E.g.: you want to run pwsh.exe but without a window (with whatever parameters you want)
You take hiddenw.exe, rename it to pwshw.exe and place it next to pwsh.exe (or place it anywhere else within your PATH)
Then you can just call pwshw where you where calling pwsh before, and it will just work as before, just that it wont show the actual window.

PS: you cant find anything on pwshw or powershellw, because there is nothing :D
To my knowledge it never got implemented. It didnt take me that long to do it, so is dont really get why they are not including anything like it in the actual language.
But honestly, after meeting a few ppl of the core team on a conference, i dont think they have this in focus.

@yokhoe
Copy link
Author

yokhoe commented Oct 4, 2023

pwshw where you where calling pwsh before

so... if I get what you're saying... instead of
powershell.exe -executionpolicy bypass -file .\Create-IntuneSystemtrayV2.ps1
I can go with a renamed hiddenw.exe (to pwshw.exe)
pswhw.exe -executionpolicy bypass -file .\Create-IntuneSystemtrayV2.ps1 or c:\project\path\pswhw.exe -executionpolicy bypass -file .\Create-IntuneSystemtrayV2.ps1
?

I would like to contain this into its own thing rather than to the system's ENV or PATH if at all possible.

@SeidChr
Copy link
Owner

SeidChr commented Oct 5, 2023

I don't get what you mean by containing it.

You can put it in any folder you like. As long as it can be found from where you are using it, v you should be good.

If you make the file pwshw.exe it will try to call pwsh.exe. if you make it powershellw.exe, it will try to call powershell.exe. it will call the first instance of the executable it can find in your PATH.

if you put the renamed file right next to the target, this lookup will just be so much faster 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants