Skip to content
Browse files

Fix cmd popping up for a blink when elevating a process

By looking at `ShellExecute` documentation:

I see that the fifth argument corresponds to `vShow`:

> A recommendation as to how the application window should be displayed initially.

The current value, 1, corresponds to:

> Open the application with a normal window. If the window is minimized
> or maximized, the system restores it to its original size and
> position.

A better value seems to be 0:

> Open the application with a hidden window.

This change effectively hides the cmd window and gives a more polished
  • Loading branch information...
Juan Cruz Viotti
Juan Cruz Viotti committed Nov 26, 2015
1 parent e7d3494 commit 3a7ab1d25fe3d17454d4abe099457da28dabdfdf
Showing with 1 addition and 1 deletion.
  1. +1 −1 windosu-elevate.cmd
@@ -30,7 +30,7 @@ If ERRORLEVEL 1 (

:: Create a temporary VBScript
Echo Set objShell = CreateObject^("Shell.Application"^) > %_tempvbs%
Echo objShell.ShellExecute "%~f0", "", "", "runas", 1 >> %_tempvbs%
Echo objShell.ShellExecute "%~f0", "", "", "runas", 0 >> %_tempvbs%

:: Relaunch this script 'As Admin'
cscript "%_tempvbs%" //nologo

0 comments on commit 3a7ab1d

Please sign in to comment.
You can’t perform that action at this time.