Jump to content

Using Run() to run files other than .exe, .com, etc


neogia
 Share

Recommended Posts

I've checked and checked and re-double-checked the FAQ already, but... I'm trying simply to open the services control, which can be found in Control Panel/Administrative Tools/Services. The path to the file is: C:\WINDOWS\system32\services.msc

As it is not an .exe, .com, .bat, etc.. Run() gives an error. I've tried:

RunWait(@COMSPEC " /c Start C:\WINDOWS\system32\services.msc")

With no luck. Am I doing something wrong?

RunWait(@COMSPEC " /c Start c:\windows\system32\services.msc")

WinWait("Services", "Services (Local)")

$text = ControlGetText("Services", "Services (Local)", 12786)

MsgBox(0, "Services Tester", $text)

Exit

The error message I receive is:

"Error: Error in expression."

Please help!

[u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia

Link to comment
Share on other sites

Hi neogia. Welcome to the forums.

Looks to me like you forgot the '&" after 'COMSPEC'. I ran the modifed code just fine.

RunWait(@COMSPEC & " /c Start c:\windows\system32\services.msc")

WinWait("Services", "Services (Local)")

$text = ControlGetText("Services", "Services (Local)", 12786)

MsgBox(0, "Services Tester", $text)

Exit
Link to comment
Share on other sites

Thanks for the timely response. In that case, the FAQ needs to be updated with the missing "&"

Thanks again.

True, the 3.1.1 helpfile has the missing & but is already corrected within the Beta Helpfile. Very misfortunate for the error to have misled you.
Link to comment
Share on other sites

RunWait("c:\windows\system32\mmc.exe c:\windows\system32\services.msc")

I understand what that line of code does, but how did you determine ".msc" files are handled by "mmc.exe"?

[u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia

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...