Jump to content

Search the Community

Showing results for tags 'run()'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 4 results

  1. Hi there! 😃 I've 2 simple scripts: Script 1 starts script 2 Script 1 gets executed with normal user rights (un-elevated) Script 2 contains an #RequireAdmin and therefor can only start elevated I want to read the output of script 2 with script 1 AND have the UAC of script 2 being activated as fullscreen Script 1 (Scripts location is the same as script 2 that I'm running with Run() Local $iPID, $sOutput $iPID = Run(@ComSpec & " /c " & "C:\Entwicklung\Autoit\Test\Temp.exe", @ScriptDir, @SW_HIDE, 0x2) ProcessWaitClose($iPID) $sOutput = StdoutRead($iPID) StdioClose($iPID) ConsoleWrite($sOutput) MsgBox(1, 1, 1) Script 2 (compiled as Temp.exe) #RequireAdmin ConsoleWrite("Return") MsgBox(1,1,"ADMIN") Now my problems are the following: Without the #RequireAdmin I can read the output with no problem, but not with the #RequireAdmin ($sOutput is empty) Using @SW_HIDE in the Run() command makes the UAC always start minimized (see attached picture) and the admin has to always manually click on the icon to enter his credentials since the UAC doesn't start in fullscreen. Here and on a few other sites they explain that the program launching the elevated program NEEDS to be activated in order to directly show the UAC fullscreen and not minimized. Using @SW_SHOW would get rid of the problem, BUT that leaves me with an ugly cmd.exe floating the whole time while the elevated script ist running. And my questions to that I'm seeking an answer for are: Problem 1: Is it just not possible to read from an elevated program with an un-elevated user/script? I also get the Access Denied if I press No on the UAC as an Output in $sOutput (Guess since its's still un-elevated) Problem 2: Is there a way to either make the floating black and blank cmd.exe being moved to the background and be non visible to the user OR to somehow bring the minimized UAC to the foreground/fullscreen? What I already tried and what didn't help me: $iPID = Run(@ComSpec & " /c " & "C:\Entwicklung\Autoit\Test\Temp.exe", @ScriptDir, @SW_HIDE, 0x2) While Not WinExists("Temp.exe erfordert Ihre Berechtigung") ConsoleWrite(1) WEnd WinActivate("Temp.exe erfordert Ihre Berechtigung") WinSetState("Temp.exe erfordert Ihre Berechtigung", WinGetText("Temp.exe erfordert Ihre Berechtigung"), @SW_SHOW) WinSetState("Temp.exe erfordert Ihre Berechtigung", WinGetText("Temp.exe erfordert Ihre Berechtigung"), @SW_MAXIMIZE) WinSetState("Temp.exe erfordert Ihre Berechtigung", WinGetText("Temp.exe erfordert Ihre Berechtigung"), @SW_ENABLE) The While-Loops helps a lot and also stops after a second or so (► Stops to write ones (1)). That means that the actual "window" of the UAC is found, but all the WinXXX functions don't do anything and the UAC stays minimized. I also tried to minimized/move the cmd.exe to the background with WinActivate() and WinSetState() with no success. $iPID = ShellExecute("C:\Entwicklung\Autoit\Test\Temp.exe", "", @ScriptDir, "open", @SW_HIDE) Using ShellExecute() instead of Run() completely solves the UAC to fullscreen problem BUT I haven't found a consistent way to read the output of ShellExecute(). Neither here on the forum nor somewhere else. If I'd be possible to read the output from ShellExecute() then all my problems would be solved at once! Also tried a few more things and playing with some parameters but everything with no success. I'd really love some help and support here from you. Thanks in advance!
  2. I am new to AutoIT & need to run application with different user credentials. I am using below script with RunAs() but the application is not invoking. #include <AutoItConstants.au3> $sUserName = $CMDLine[1] $sDomain = $CMDLine[2] $sPassword = $CMDLine[3] RunAs($sUserName, $sDomain, $sPassword, $RUN_LOGON_NOPROFILE,"ssms.exe") Kindly assist! Thank you
  3. Hi Only on some Windows 10 PCs do I get the issue that the Run() fails with the @SW_HIDE = Hidden window (or Default keyword) option. Not all Win10 machines, only some, but then consistently. I have put UAC to lowest level, no joy. As if the OS does not allow the hidden window to be created... Seems that @SW_MINIMIZE = Minimized window or @SW_MAXIMIZE = Maximized window does not suffer the same fate. I will have more info in a day or so. Anybody else with similar experience? Skysnake
  4. I have a function that runs a DOS command and returns the output of the command, and it returns the correct data for some commands, bu tnot for others. I've narrowed it down to this: "HELP FIND" returns nothing "HELP DIR" returns several strings of help info. Here's my test code: #include <Constants.au3> test() Func test() Local $sSTDOUT, $cmd $cmd = "C:\Windows\System32\help.exe find" ;$cmd = "C:\Windows\System32\help.exe dir" $sSTDOUT = _RunDosCmd($cmd) ConsoleWrite("+++: $sSTDOUT ==>" & $sSTDOUT & "<==" & @CRLF) MsgBox(0, "INFO", "$sSTDOUT ==>" & $sSTDOUT & "<==") EndFunc ;==>test Func _RunDosCmd($sDosCmd) Local $cmd, $iPID, $sSTDOUT, $ar, $err $cmd = @ComSpec & ' /C ' & $sDosCmd ConsoleWrite("+++: $cmd = " & $cmd & @CRLF) ; Run the command, capturing the STDOUT data $iPID = Run($cmd, "", @SW_HIDE, $STDERR_MERGED) ; <== merge STDOUT and STDERR ; Success: the PID of the process that was launched. ; Failure: 0 and sets the @error flag to non-zero. $err = @error ConsoleWrite("+++: $err = " & $err & " after call to Run()" & @CRLF) ConsoleWrite("+++: $iPID = " & $iPID & " after call to Run()" & @CRLF) If ($err) Then ConsoleWrite("+++: Error returned by Run()" & @CRLF) Return ("") EndIf ; Wait until the process has closed using the PID returned by Run. ProcessWaitClose($iPID) ; Success: 1 and sets @extended to the exit code of the process. ; Failure: 0 if the wait timed out. On invalid PID the @error flag ; is set to non-zero and @extended is set to 0xCCCCCCCC. $err = @error ConsoleWrite("+++: @error = " & $err & " after call to ProcessWaitClose()" & @CRLF) ; Read the merged STDOUT/STDERR stream of the PID returned by Run. $sSTDOUT = "" While (1) $sSTDOUT &= StdoutRead($iPID) $err = @error If ($err) Then ExitLoop WEnd Return ($sSTDOUT) EndFunc ;==>_RunDosCmd
×
×
  • Create New...