I only want the UAC prompt to be asked for the net.exe[.] Is it possible?
To the best of my knowledge, the answer is likely "No".
The UAC is being displayed for
nircmd so it can run
net start with the proper elevated privileges (which are required by Windows). This elevation must occur before
net start is run. In my experience, this is generally true of many third-party programs or scripts that perform a similar function.
Elevate is an exception (i.e. it will display
Net Command in the UAC), but then again, it doesn't suppress the console window like
After that I don't want the console window to appear.
Though a console window might appear with other solutions (e.g.
.vbs script), a new console window does not appear after running
nircmd elevatecmd execmd net start example_service.
Suppressing The Console Window
While it likely isn't possible to display
net.exe in the UAC, you can suppress the console window for the batch file (which it honestly sounds like is your true goal, if I am not misreading things too badly):
.bat file e.g.
start_service.bat with something like the following:
C:\path\to\nircmd.exe elevatecmd execmd net start example_service
Create a new shortcut somewhere to run this
.bat file. Make the target similar to the following:
C:\path\to\nircmd.exe execmd C:\path\to\start_service.bat
For this example, when this shortcut is used (not the
.bat file directly), only the UAC prompt will be displayed (no console window will appear).