Jump to content
PoojaKrishna

[SOLVED]Run command stopped execution

Recommended Posts

PoojaKrishna
Posted (edited)

Hi friends,

The Run command on my machine suddenly stopped execution.

Anyone of you facing the same issue?

#include <AutoItConstants.au3>
#include <FileConstants.au3.>
#RequireAdmin
$ExeName = FileOpenDialog("Select AutoIt executable", @ScriptDir & "\", "(*.exe)", $FD_FILEMUSTEXIST)
If not @error Then
    If FileExists($ExeName) Then
        $iPID = Run($ExeName, "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)
        If @error Then
            msgbox(0,"Failed", "Failed execution with @error: " & @error)
        EndIf

    Else
        Msgbox(0,"", "File does not exist")
    EndIf

EndIf

The above code always fails to execute the executable file. It was working perfect and stopped working now.

I have tried adding the files and folders to windows defender exclusion list and uninstalling the anti virus but still no luck.

OS: Windows 10 - 64 bit

Please help.

 

Edited by PoojaKrishna

Share this post


Link to post
Share on other sites
JLogan3o13

Uhhhhh, you have it set to @SW_HIDE. Are you sure it is not running the exe? It works fine for me (when I remove the hide of course)


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

Share this post


Link to post
Share on other sites
PoojaKrishna
24 minutes ago, JLogan3o13 said:

Uhhhhh, you have it set to @SW_HIDE. Are you sure it is not running the exe? It works fine for me (when I remove the hide of course)

Yes, I'm sure it is not working as I always get the message box:

---------------------------
Failed
---------------------------
Failed execution with : 1
---------------------------
OK   
---------------------------
 

Share this post


Link to post
Share on other sites
JLogan3o13

And this is on any executable..if you browse to notepad.exe or cmd.exe is is failing as well?


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

Share this post


Link to post
Share on other sites
PoojaKrishna
11 minutes ago, JLogan3o13 said:

And this is on any executable..if you browse to notepad.exe or cmd.exe is is failing as well?

Tested for that only now, and found it working for all executable other than executable from a particular path : D:\Pooja Projects.

 

 

Share this post


Link to post
Share on other sites
BrewManNH

Is D: a network drive?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
PoojaKrishna
Posted (edited)
3 minutes ago, BrewManNH said:

Is D: a network drive?

No, it is not a network drive. It is working for all other folders on D: other than the mentioned folder.

It was working perfect till last day and suddenly stopped working today with no change in my codes or system settings.

Edited by PoojaKrishna

Share this post


Link to post
Share on other sites
Earthshine

doesn't look look like an AutoIt problem then, guess your antivirus doesn't like that exe


My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
AdamUL

It could be related to the following with Windows 10 issue.  

 

Adam

 

Share this post


Link to post
Share on other sites
PoojaKrishna
Posted (edited)
11 minutes ago, Earthshine said:

doesn't look look like an AutoIt problem then, guess your antivirus doesn't like that exe

Yes, may be. But I uninstalled the antivirus and restarted the machine.

8 minutes ago, AdamUL said:

It could be related to the following with Windows 10 issue.  

It is not a shared folder too.

I can move the files to an another folder to make it work for now.

 

 

Edited by PoojaKrishna

Share this post


Link to post
Share on other sites
Earthshine
Posted (edited)

i am having an issue where the UDF zips all report virus, but there is none. sigh. Latest Win 10, 3 real computers and 3 virtual, all same....

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Deye
Posted (edited)

PoojaKrishna,

What if you first backup or rename the folder .. \user\AppData\Local\AutoIt v3
so it doesn't exist  and  try again

Edited by Deye

Share this post


Link to post
Share on other sites
PoojaKrishna
7 hours ago, Deye said:

PoojaKrishna,

What if you first backup or rename the folder .. \user\AppData\Local\AutoIt v3
so it doesn't exist  and  try again

Deye,

Tried but no help. But the system does not allow me to rename the folder D:\Pooja Projects, even if no files of the folder are open. Seems to be infected. 

Share this post


Link to post
Share on other sites
PoojaKrishna

Copied all the files to a new folder and it is working . But no idea about the issue with other folder.

Thank you for all your help.

Share this post


Link to post
Share on other sites
jdelaney
Posted (edited)

Run commands don't like spaces in paths unless you add quotes around it. ..same is true through the command line

Example

$s = '"./some dir/some.exe"'

Or, on the run itself:

Run ('"' & $yourvariable & '"')

Edited by jdelaney
  • Like 1

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
PoojaKrishna
Posted (edited)

Yes jdelancey, corrected and it worked perfect.

Thank you so much for your help.

Edit: But still not sure how it was working earlier in the same folder.

Edited by PoojaKrishna

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

    • nacerbaaziz
      By nacerbaaziz
      Hello
      i have searched a lot about how to run external programs with the administrator privileges without the script running with administrator privileges using autoit
      But all my attempts failed
      Finally, today I found the VBS function doing this task
      I immediately transferred it to our beloved language (autoit) and i decided to share it with you
      i hope you like it
      This is a simple example about how to use the function

      runAsAdmin("cmd.exe", "/c @echo off & cls & echo test & pause", "c:\", @sw_show)
      this is the function

      func runAsAdmin($program, $parameters = "", $workingDir = @workingDir, $show = "") local $oShell = OBJCreate("Shell.Application") if isOBJ($oShell) then local $result = $oShell.ShellExecute($program, $parameters, $workingDir, "runas", $show) else $result = false endIf return $result endFunc
       
    • rudi
      By rudi
      Hello,
      for a script to display PDF files I'd like to simply use the default program for PDF files, so I used "ShellExecute(<pdf-file-full-path>)" to open these files.
       
      The result for *SOME* of the workstations is, that the Adobe Reader starts up with asking for its language. (English/German). When starting AcroRd32.exe through "ShellExecute()", this "choose your language" dialog is showing up *ALWAYS*.
       
      Just to have mentioned it: Process Explorer is presenting this command line, it looks the same for both, PCs with and without that question "Choose Language? [English|German]"
      "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" --channel=4680.0.860715181 --type=renderer "\\pc0009\Y_DRV_H\Daten\TIF\08\32\G000110832_Freigegeben.idw.pdf"  
      The next approach I thought of was to use Foxit Portable (instead of Acrord32.exe), started from a Network Drive, but it's starting up ugly slowly...
      So I tried to "Run()" instead to "ShellExecute()" the Adobe Reader. Now the result looks more stange, the "select your language" dialog shows up every now and then, but not always for the Win7 installations affected.
       
      If I place a "msgbox()" just in front of the "run()" command, it seems never to show this "select your language" dialog.
      If I take out this MsgBox() the "select your language" dialog shows up sometimes.
      When I "ClipPut()" the run command prior the "Run()" and paste that one to a CMD box, then it seems to *NEVER* happen, that this "select your language" dialog shows up.
       
      "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" "\\pc0009\Y_DRV_H\Daten\TIF\08\32\G000110832_Freigegeben.idw.pdf" $AcroRead='"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe"' $PDF='"Y:\Temp\DRV_H\Daten\TIF\33\85\153385_Freigegeben.dwg.pdf"' MsgBox(0,"Values",$AcroRead & @CRLF & $PDF,1) $MyCommand=$AcroRead & " " & $PDF ClipPut($MyCommand) Run($MyCommand)  
      It looks like, that this "--channel=... --type=renderer" parameters are always fact for the AcroRd32.exe instance, that is opening the PDF to be displayed. The Instance opening the "PDF Display GUI" seems to always be a child process of another AcroRd32.exe process.
       
      Any clue, what's going on "backstage" here? How to avoid this "Choose your language" dialog? Or maybe someone can mention a different "portable" PDF viewer, I could use for this purpose?  
      Any suggestions appreciated, regards, Rudi.
    • 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?
    • e45678mail
      By 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?
       
       
×