Jump to content

Recommended Posts

Posted

When I execute any batch command then it is prompting a command window for 1 second till the command executes with the below command.

 

$CMD = "net localgroup administrators domainaname\usename /add"
RunWait(@ComSpec & " /q /c " & $CMD)

 

Is there any way to exeute the command without showing the window.

Posted

Set parameter 3 of RunWait to @SW_HIDE.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 12/30/2015 at 10:18 AM, water said:

Set parameter 3 of RunWait to @SW_HIDE.

Previously I tried with below command hoping that second argument is mandatory and it didn't work.

RunWait(@ComSpec & " /q /c " & $CMD,@SW_HIDE)

 

It is working only when we give second argument also.

 

RunWait(@ComSpec & " /q /c " & $CMD,@ScriptDir,@SW_HIDE)

 

Thanks for the input.

Posted

Correct. When you do not want to specify the second argument then set it to "". That's how it is documented in the help file.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Some aspects of the manifest can be set using the #pragma directive.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 12/30/2015 at 10:38 AM, water said:

#RequireAdmin?

This one won't elevate the app, but it restrict the code block to write condition whether it is running in elevated mode or not.

But is there any way to keep otion while building so that user when double clicks the exe, then he should be prompted with UAC window.

Posted

That's what #RequireAdmin does. When you start the script you get the UAC prompt.
Run this script and you will get "1" if run as admin:

#RequireAdmin
MsgBox(0, "", "IsAdmin: " & IsAdmin())

 

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 12/30/2015 at 10:47 AM, ur said:

But is there any way to keep otion while building so that user when double clicks the exe, then he should be prompted with UAC window.

It's the job of #RequireAdmin, at the beginning of your script.

 

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
×
×
  • Create New...