zYx

Fresh Windows 10 Pro - Run doesn't work properly

18 posts in this topic

#1 ·  Posted (edited)

Hi,

 

I tried to find something regarding my issue, but I couldn't.

 

My scripts that were usually running fine on my previous Windows 7, are not running properly on my newly installed Windows 10 Pro.

 

Sleep(14000)
Run("C:\Program Files (x86)\MSI Afterburner\MSIAfterburner.exe")
Sleep(5000)
Run("C:\Program Files\Core Temp\Core Temp.exe", "" ,@SW_MINIMIZE)
Sleep(5000)
WinSetState("Core Temp 1.1", "", @SW_MINIMIZE)
Sleep(1500)
Run("C:\Users\zyxsc\Documents\LCDHost\bin\LCDHost.exe","", @SW_MINIMIZE)
Sleep(15000)
WinClose("zyx - LCDHost")
Sleep(10000)
Run("C:\Program Files\Everything\Everything.exe -startup")

So what happens is:

MSIAfterburner does not open, Core Temp doesn't open, LCDHost.exe does open fine and closes the window fine, Everything.exe does not open.

 

Any idea why?

Edited by zYx

Share this post


Link to post
Share on other sites



The obvious first question is do those files exist in those locations and do they work if you run those commands manually?

Second question: check the process manager, are the processes really not started?

Third, check the result and errorlevel of the Run commands (as in $pid = Run("something") and then ConsoleWrite($pid & @CRLF & @error & @CRLF ) ) and see whether you get a pid and/or a non-zero @error.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi,

 

yes, all files do exist, task manager doesn't show those apps, so no, they are really not running.

 

I'm not sure how to follow your third advise :( do I just add  $pid =   in front of Run?

I did this:

Sleep(1000)
$pid = Run("C:\Program Files\Core Temp\Core Temp.exe", "" ,@SW_MINIMIZE)
ConsoleWrite($pid & @CRLF & @error & @CRLF )

but nothing really happens..

Could it be something to do with permission level to Program Files folders?

Edited by zYx

Share this post


Link to post
Share on other sites
$pid = Run("notepad.exe")
MsgBox(64, "notepad.exe pid:", $pid)

$pid = Run("doesntexist.exe")
MsgBox(64, "doesntexist.exe pid:", $pid)

The first one will (or rather should, if notepad.exe is run properly) show you a non-zero PID in the MsgBox, the second one will show a PID of 0 as the process failed to launch.

The permissions, sure, could be... For good measure, try putting #RequireAdmin on top of your script, run it and allow the process elevation.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

put these two lines at the top

#include <WinAPIFiles.au3>
_WinAPI_Wow64EnableWow64FsRedirection(FALSE)

 


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

11 minutes ago, iamtheky said:

#include <WinAPIFiles.au3> _WinAPI_Wow64EnableWow64FsRedirection(FALSE)

This didn't really work :(

but this did:

13 minutes ago, SadBunny said:

#RequireAdmin

In relation to this:

13 minutes ago, SadBunny said:

$pid = Run("notepad.exe") MsgBox(64, "notepad.exe pid:", $pid) $pid = Run("doesntexist.exe") MsgBox(64, "doesntexist.exe pid:", $pid)

I added MSI Afterburner locaton, but kept getting popup error with wrong PID etc..

err.jpg

Edited by zYx

Share this post


Link to post
Share on other sites
1 minute ago, zYx said:

kept getting popup error with wrong PID etc..

What do you mean? What kind of popup error and how is the PID wrong?


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

UAC or redirection, it's generally that coinflip on upgrade/architecture issues.  glad its not the issue, but If dancing between (x86) and x64 directory structure i would still recommend it.

Edited by iamtheky
posting/editing race condition

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

2 minutes ago, SadBunny said:

What do you mean? What kind of popup error and how is the PID wrong?

 

err.jpg

 

$pid = Run("C:\Program Files (x86)\MSI Afterburner\MSIAfterburner.exe"")
MsgBox(64, "C:\Program Files (x86)\MSI Afterburner\MSIAfterburner.exe" pid:", $pid)

$pid = Run("notepad.exe")
MsgBox(64, "notepad.exe pid:", $pid)

$pid = Run("doesntexist.exe")
MsgBox(64, "doesntexist.exe pid:", $pid)

 

Edited by zYx

Share this post


Link to post
Share on other sites

You have double, double quotes on the end of your run command. The error message is telling you just what is wrong.

1 person likes this

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

Share this post


Link to post
Share on other sites

edited above as you posted:

looks like your run command has a double set of "" at the end, but only one at the beginning.

1 person likes this

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

Change the end of that first line from 

MSIAfterburner.exe"")

to 

MSIAfterburner.exe")

 


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Haha... "if you don't know it by now, you will never never never know it, oooh ohohohoooh" :) 


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Sorry guys, but that was a typo and it wasn't a problem.

 

#RightsAdmin, sorry -> #RequiresAdmin did help though.

Edited by zYx

Share this post


Link to post
Share on other sites

@zYx I am assuming, in case someone should come upon this thread in a future search, you mean #RequireAdmin

1 person likes this

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

Share this post


Link to post
Share on other sites

Try using "shellexecute" instead of "run".  Run is meant more for executables that you would open in the "run" prompt when you press "win key + R".  Kind of like Ipconfig,exe or something similar.  If you must run the application using the "run" command, precede it with the @Comspec macro to call the command prompt to open the file.  An example would be as follows:

Run ( @comspec & " /c yourexecutablefile.exe", "Path_to_directory_containing_executable" )

1 person likes this

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

19 hours ago, JLogan3o13 said:

 

@zYx I am assuming, in case someone should come upon this thread in a future search, you mean #RequireAdmin

 

Sorry, yes :/ I corrected it now.

17 hours ago, MattHiggs said:

Try using "shellexecute" instead of "run".  Run is meant more for executables that you would open in the "run" prompt when you press "win key + R".  Kind of like Ipconfig,exe or something similar.  If you must run the application using the "run" command, precede it with the @Comspec macro to call the command prompt to open the file.  An example would be as follows:

Run ( @comspec & " /c yourexecutablefile.exe", "Path_to_directory_containing_executable" )

Thanks, I will use this at some point in future, I'm sure :]

 

Edited by zYx

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