Jump to content
e45678mail

How to enable test mode by "run" or "shellexecute"?

Recommended Posts

e45678mail

Hi~

I have some question about how to enable the test mode via "Run" or "shellexecute" of command,

was to tried :

-----

Run("bcdedit.exe /-set testsinging on", "C:\Windows\System32")

and

shellexecute("bcdedit.exe /-set testsinging on", "C:\Windows\System32")

-----

since this command must to run through administrator competence,

have any method can accomplish it?

 

 

Edited by e45678mail

Share this post


Link to post
Share on other sites
JLogan3o13

Have you tried adding #RequireAdmin at the top of the script?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
e45678mail
13 hours ago, JLogan3o13 said:

Have you tried adding #RequireAdmin at the top of the script?

Yes, this command already to include,

seem as the command type is incorrect:

Run("bcdedit.exe /-set testsinging on", "C:\Windows\System32")

and

shellexecute("bcdedit.exe /-set testsinging on", "C:\Windows\System32")

 

Share this post


Link to post
Share on other sites
BigDaddyO

if you run that from a CMD prompt manually, does it work?  once you get it to work from the command line, then you can use it in the Run()

if you really need Admin, then you should launch the cmd.exe as Administrator when testing this line.

bcdedit.exe /set testsinging on


Share this post


Link to post
Share on other sites
e45678mail
On 2017/12/1 at 11:35 PM, BigDaddyO said:

if you run that from a CMD prompt manually, does it work?  once you get it to work from the command line, then you can use it in the Run()

if you really need Admin, then you should launch the cmd.exe as Administrator when testing this line.

bcdedit.exe /set testsinging on

Yes, if run this command in CMD.exe and by Admin, it is workable.

but can't work by Run() with AutoIT,

you mean under AutoIT can through following to execute it?

-----

#RequireAdmin

Run("bcdedit.exe /set testsinging on")

-----

Share this post


Link to post
Share on other sites

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

  • Similar Content

    • rkr
      By rkr
      Hi, I have a software which has a 'run file'-ie; when i double click on that file, the input file of the software is run by the software. I wish to double click/execute this run file using autoit. how do i achieve this. i opened the software and it shows the input file and run file in same folder, i will put my autoitscript file too in same location. how do i simulate double clicking the run file (using its file name, say - abc.run ). I entered the following lines to make software window active - it became active, dont know how to go forward
      Winactivate("program title")
      winwaitactivate("program title")
      controlclick("program title","abc.run",1000,"primary",2) ; 1000 is ctrl id
    • tremolux66
      By tremolux66
      Initial Problem
      I've written several scripts with the following sequence:
      Execute a program using Run w/stdout+stderr captured Typically processes all the files in one directory tree to populate a second tree Execute a second program (also with Run) to monitor the products of the first program and Display a progress bar (percentage of output files complete) Also monitor the first program's process and exit when it terminates The script then calls ProcessWaitClose (no timeout) on the first program's process and Checks the first program's results Kills the monitor program if it hasn't already exited on its own. Sometimes, ProcessWaitClose returns 1 with @error = 0 and @extended = 0xCCCCCCCC (actually, 0xFFFFFFFFCCCCCCCC), which seems ambiguous: the documentation says that @error = non-zero and @extended = 0xCC... means an invalid PID (unclear what the return value is), and 1 is returned for non-existent processes (but no mention of @extended). The 1/0/0xCC... result seems to occur when the first program exits very quickly (with or without an error). Since the exit value is not available, the script scans the program's output and tries to determine whether it ran successfully. This has gotten complicated and unreliable.
      Partial Fix
      I've now implemented a much simpler approach that works for most cases:
      Modify the monitor program so that it ignores the other program's process (the monitor always gets killed by the script anyway) Execute the monitor program first using Run, then execute the processing program with RunWait When RunWait returns, the child process exit value is available, so the script can ignore its output (which isn't available anyway) If the monitor program is still running, kill it. Remaining Issue
      However, there are still a couple of cases where it's necessary to get both the exit value from the processing program and its output. Since RunWait doesn't capture stdout and stderr for the parent script, it's looking like I'll have to call RunWait and redirect the 2 streams to a temp file and then scan it. Also, to do the redirect, I think I'll have to use @ComSpec to execute the processing program, which adds an undesired layer.
      Does anybody have a better (cleaner) way to handle these cases?
    • BlazerV60
      By BlazerV60
      Hello all,
      I've written the code below which launches chrome in incognito mode and then proceeds to go to the autoit website.
      From my understanding, the Run() command is also supposed to output the PID number related to the application that got launched from the Run command.
      However when I run the below lines, it outputs a PID number that is different from the newly launched chrome browser's PID number, does anyone know why and possibly explain how I could retrieve the accurate PID number associated with the newly launched browser?
      Global $iPid = Run(@ComSpec & ' /c start chrome.exe https://www.autoitscript.com/forum/ -incognito' ,"", "") msgbox(0,"",$iPid) Thank you,
      Brian
    • BlazerV60
      By BlazerV60
      Hello all,
      I've been trying to figure out how to launch Google Chrome in the background (hidden) but it doesn't seem possible. I've tried the following methods:
      ShellExecute("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "", "", "", @SW_HIDE) Also I've tried:
      ShellExecute(@ComSpec, "/c start chrome.exe","","",@SW_HIDE) Lastly I tried:
      RunWait('"'&@ProgramFilesDir&'\Google\Chrome\Application\chrome.exe" --silent-launch',@ScriptDir)  
      But all of them launch my chrome browser without hiding it. Does anyone know a workaround for this or if AutoIT just can't Chrome? 
      Bonus points if you know how to make it launch chrome hidden and make it go to https://www.autoitscript.com
       
      Thank you,
      Brian
    • Miloud
      By Miloud
      How to get the result of the command?
      My code :
      Local $iRc = ShellExecute ( "G:\ffmpeg\bin\ffmpeg.exe" , "-version" , "G:\ffmpeg\bin\") ProcessWaitClose($iRc) $Message = StdoutRead($iRc)
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.