Jump to content

ShellExecute parameters not working on some PCs


Recommended Posts

I am trying to pass some parameters to another script using ShellExecute, thisworks fine on Win10 but not on Win7.

I have cut the code down to the bare minimum to illustrate the problem. This is the code with ShellExecute

$test_Params = "a b"
ShellExecute("shellexecute_test.au3", $test_Params)

This is the code that is being called (shellexecute_test.au3):

msgbox(0,"",$CmdLine[0])

The win7 PC reports 0, Win10 reports 2

Could there be a permissions issue?
Is there another way to make this work?

Edited by weirddave
Link to comment
Share on other sites

It runs, I get a message box with 0 in it (which would be correct when launching it this way). If it wasn't launching correctly I wouldn't get the msgbox at all with the shellexecute method :) 

I'm actually double-clicking the au3 with the shellExecute in it as it happens.
If I compile shellexecute_test it works, but this isn't convenient for debugging :( 

Link to comment
Share on other sites

Try running the *.exe script "as administrator" .  If that solves the problem, it could be the particular AnitVirus program installed on the PC that is interfering with program operation or it could be the security settings of Windows itself.

-pete

 

 

Link to comment
Share on other sites

@weirddave hi

did you checked the ps restriction ?

do you execute the powershell command in the rigth directory ? 

Is powershell installed on w7 computer also ? 

If no you have to import powershell module 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Regedit told me that the key was set to  "C:\engsys\AutoIt\AutoIt3.exe" "%1"

I have changed it to "C:\engsys\AutoIt\AutoIt3.exe" "%1" %*

which seems to have fixed it. 

Interestingly, my key name was HKEY_CLASSES_ROOT\Applications\AutoIt3.exe\shell\open\command

I suspect what I've done is associate au3 files with the exe rather than install autoit on this particular PC. It's coming back to me now, the admin doesn't want to see "random" installs that aren't on the approved list and C:\engsys is ignored by the virus protection here ;) 

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