Jump to content

Windows 10 says it cannot run my script


Recommended Posts

I have had a simple Autoit script running for a few years now on my Win 7 laptop.  Once started it just runs until the machine is restarted, usually when Windows Update requires this, otherwise the machine runs 24/7.   I just upgraded the laptop to Win 10.  Everything works still, except...

I was puzzled that my script did not run at the set time, so I looked around, and clicked the desktop icon for the autoit file which starts it up. "The file this link relates to has been deleted or moved", or words to that effect.  It took me ages using an unfamiliar system to track the file down (whatever was so wrong with My Computer that they had to change it ?  Why can I no longer just click on a column header to sort files like the rest of the world does ? (did) - grumble, grumble, grumble).   When I found it, I clicked on it and was told that "Windows 10 can not run this file" (or words to that effect). No hint as to why not.

With the best will in the world, all I can do now is shout "PLEASE HELP!".  Is there any point in rewriting the script, possibly installing AutoIt and compiling it on the machine the script is going to run on ?  The original script was written on a Vista machine, and only the compiled exe file was on the Win7 (now Win10) machine.  Of course, it does not help that I am not yet familiar with the Win10 way of doing things, and I avoided Win 8, so some aspects of the new O/S are baffling.

All the script does is shut down a program and start it again, in order to break the data the program produces into usable 24 hour sessions.  It operates at an unsociable hour, well after bedtime, because that's when the data flow is slowest, so very little is lost during the process.

 

Thanks

 

Michael Hooker

Link to comment
Share on other sites

I have had an exhausting few days with many late nights trying to fix a network problem introduced by the Win10 upgrade, and had forgotten exactly what Win10 said by this morning.  I have tried it again and it says "This app can't run on your PC - To find a version for your PC, check with the software publisher"

Although I found the exe file, what is there seems to be something other than the file that has been happily running for 30 months as Properties shows it as having zero bytes now. That might explain why it can't run, but surely the message should tell me it's an invalid file, not suggest that it needs an upgrade.  Or maybe it is a function of Win 10 that it kills off programs it doesn't like in this way without giving any warning message at the time.

 

On the subject of the code, I have yet to find it.  It may have been on a now-defunct laptop, or possibly on one in store now. The code certainly worked on the Win 7 machine, and as I recall members of this Forum helped me write it (I wasn't using the same login details then, the ones I have recorded here from then wouldn't let me in this time).

Michael Hooker

 

Link to comment
Share on other sites

Is it an autoit script file (.au3), or a compiled script.

Could it be that this is the action of an antivirus program ? Check the log files and quarantine.

I am happily using Windows 10 on this moment without issues.

Link to comment
Share on other sites

I had this problem with Windows 8.1. If it's a 64-bit Windows installation, try compiling the script as a 64-bit application and run it. It shouldn't matter, but it seems with SmartScreen it sometimes does.

I probably don't need to mention this, but if you're running 32-bit Windows, you'll need a 32-bit executable -- you'll get the same error message trying to run a 64-bit application.

Link to comment
Share on other sites

OTOH there is a huge advantage with that: a zero-byte program is provably both non malicious and bug-free. Keep positive!

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

I have tracked this down to Windows Defender.  I found my script on a Vista laptop which also uses Defender.  And while I was looking at the folder containing my scripts and the compiled exes, the exes disappeared and a notification came up saying they had been quarantined.  So I set the containing folder as an exception for the scan  and unquarantined the files.   Now investigating the Win10 machine (which has also used Defender all the time I have been running the script up to now) I see that Defender has quarantined the exe file in question, declaring it a severe threat as containing a Trojan:Win32/Pocyx.F!plock, whatever that means.   I have followed the same procedure, excluding the containing folder from the scan and then restoring the exe file to it.

 

It would appear that it is only very recently that the Defender virus signatures consider this file to be such a threat.  The script is below - I think it is the right one, but it may be an early draft which I have since amended, indeed looking at it it seems to start by opening the application ("BaseStation.exe")  when what in fact happens is that BaseStation.exe is already running when  the Autoit exe closes it down and then re-opens it, so I suspect the same lines are used, just in a different order..  My memory is very poor these days so I cannot be exact about the history of the script.  I am sure it is flawed, indeed sometimes it fails to trigger the "do you really want to close this program down?" confirmation button which is the important bit I had trouble getting to work, but mostly it works just fine.  Or at least it did under Win7...  I'll just have to see what happens under Win10.

; script to stop and restart BaseStation.exe every 24 hours for 20 days
; 
For $i = 1 to 20        ; number of days to run
  Run("C:\BaseStation\BaseStation.exe")
  Sleep(86400000) ; milliseconds in a day - exact time will drift a bit but that doesn't matter
  WinClose("BaseStation SBS1")
  WinWaitActive("Confirm", "")
  Send("{! down}")
  Send("y")
  Send("{! up}")   
; BaseStation now takes a while to tidy up its sqlite database, save its data and close
  WinWaitClose ("BaseStation SBS1", "", 60)
Next
; now return to normal operation in case I forget to restart manually
 after 20 days
  Run("C:\BaseStation\BaseStation.exe")
  WinWaitActive("BaseStation SBS1")
  Sleep(10000)
  MsgBox(4160, "SBSrestart terminated.", "This script has restarted BaseStation " & String($i) & " times." , 0)

Many thanks to all who took an interest.  To cover some of the points raised, we are talking about a compiled script (I mentioned it was an exe file in my first post), and I don't understand the point about 32/64 bit - the machine was 64 bit under Win 7 when the exe file ran before and it remains so under Win 10.  Has Win 10 changed the rules ?

Michael Hooker

Link to comment
Share on other sites

Many thanks to all who took an interest.  To cover some of the points raised, we are talking about a compiled script (I mentioned it was an exe file in my first post), and I don't understand the point about 32/64 bit - the machine was 64 bit under Win 7 when the exe file ran before and it remains so under Win 10.  Has Win 10 changed the rules ?

Michael Hooker

A 64-bit exe will have a different signature, so Defender may not quarantine it. That makes much more sense than Windows refusing to run some 32-bit applications.

Link to comment
Share on other sites

im might come in to be captain obvious but have you try to run it in compatibility mode? right now win10 have some great stuff like the DX11 but is messing with all the computers on the world, unless win8 or 7, 10 does not use the compatibility mode on its default settings, so try to go to properties and run it on compatibility mode 

Link to comment
Share on other sites

  • 1 month later...

Windows 10 & Windows Defender problem:   I tried running a well-used (32-bit) script today - one that worked fine even in Windows 10 last week:  Windows Defender promptly quarantined AutoIt3.exe.  I disabled Defender, restored the file from a backup and scanned it with MBAM: Not malware as far as Malwarebytes Pro is concerned.

I reported the problem to the Windows Defender team.  This is quite extraordinary, particularly because in years of computing and fixing many machines I have never known Windows Defender to detect anything on any of our machines before.  Might as well leave it disabled and rely on MBAM?

Link to comment
Share on other sites

  • 1 year later...

Hi Everyone,

Please help me out,  i am trying to upload file using selenium and Autoit but it showing me some error which i am unable to find out why?

i tried to create the pics.exe as 64 based as well as on 32 based also but it making me some troubles.

My MAchine is windows 10.

Please give me any suggestions to run autoit on Ubuntu 16.04 LS

The CODE is : in JAVA

          WebDriver driver=new FirefoxDriver();
        
        driver.get("https://searchenginereports.net/plagiarism-checker/");
        //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
        driver.findElement(By.xpath("//input[@name='file']")).click();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        Runtime.getRuntime().exec("C:\\Users\\azmeera rahul\\Desktop\\pics.exe");
   

 

THE ERROR MESSAGE SHOWING IS:

1481681606627    Marionette    INFO    Listening on port 52640
Exception in thread "main" java.io.IOException: Cannot run program "C:\Users\azmeera": CreateProcess error=193, %1 is not a valid Win32 application
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at java.lang.Runtime.exec(Runtime.java:620)
    at java.lang.Runtime.exec(Runtime.java:450)
    at java.lang.Runtime.exec(Runtime.java:347)
    at fileHandles.FileUploadByAUTOIT.main(FileUploadByAUTOIT.java:23)
Caused by: java.io.IOException: CreateProcess error=193, %1 is not a valid Win32 application
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
    at java.lang.ProcessImpl.start(ProcessImpl.java:137)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 4 more

 

 

 

 

Thank You

Rahul Azmeera

Link to comment
Share on other sites

  • 4 years later...

I know I should not revive old topics but as I could not find any other reference to the issue I am having after a Windows 10 update and this topic saved by but, I am going to place some reference here for future similar cases.

 

After Windows 10 update, one of my scripts that I use heavily every day stopped working and message from Windows is "Access Denied".

I suspected of McAfee corporate anti virus, checked event viewer, checked Windows Defender, etc... Perhaps there was some information there, but I could not find it.

Then I started Googling and found this thread which is not the same case, but one of the proposed solutions worked perfectly to resolve the issue with my compiled exe.

To solve the issue and enable my compiled exe to run again without the "access denied" error, I just had to compile a x64 exe and now the script is back to work.

Thanks for this amazing community.

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...