Sign in to follow this  
Followers 0
mattw112

ShellExecute says can't find file

12 posts in this topic

#1 ·  Posted (edited)

I'm doing a shellexecutewait and I know the file is there, but I'm getting an error message that it doesn't exist? Can anyone tell me what I need to add? I've sent the command line to a msgbox and it looks right to me. I've never done such a long command line before.

; Execute Program using Secrets that were found
; First break down the command line so it is easier to read:
$SETUP = "\Voyager3.2.1.exe /s /v""/qn"
$LOG = " /L*v %temp%\Voyager321Setup.log"
$INSTALLTYPE = " INSTALLTYPE=NEW"
$INSTALLDIR = " INSTALLDIR=\""D:\Program Files\Corillian\Voyager\"""
$ADDLOCAL1 = " ADDLOCAL=COREFILES,VOYAGER_AT,TP,HS,VLOGSERVICE,AUTHENTICATIONCLIENT,AUTHORIZATIONCLIENT,"
$ADDLOCAL2 = "TPCLIENT,HOSTSCRIPTER,SERVERDIAGNOSTICS,WEBTEST"
$SN = " SERVICEUSERNAME="
$SP = " SERVICEPASSWORD="
$REBOOT = " REBOOT=ReallySurpress"""

; Combine Variables to build Command Line
$CMDS = @SystemDir & $Setup & $LOG & $INSTALLTYPE & $INSTALLDIR & $ADDLOCAL1 & $ADDLOCAL2 & $SN & $Secret1 & $SP & $Secret2 & $REBOOT

; Run Program with Command Lines
ShellExecuteWait($CMDS)

Thanks

Terry

Edited by mattw112

Share this post


Link to post
Share on other sites



I'm doing a shellexecutewait and I know the file is there, but I'm getting an error message that it doesn't exist? Can anyone tell me what I need to add? I've sent the command line to a msgbox and it looks right to me. I've never done such a long command line before.

; Execute Program using Secrets that were found
; First break down the command line so it is easier to read:
$SETUP = "\Voyager3.2.1.exe /s /v""/qn"
$LOG = " /L*v %temp%\Voyager321Setup.log"
$INSTALLTYPE = " INSTALLTYPE=NEW"
$INSTALLDIR = " INSTALLDIR=\""D:\Program Files\Corillian\Voyager\"""
$ADDLOCAL1 = " ADDLOCAL=COREFILES,VOYAGER_AT,TP,HS,VLOGSERVICE,AUTHENTICATIONCLIENT,AUTHORIZATIONCLIENT,"
$ADDLOCAL2 = "TPCLIENT,HOSTSCRIPTER,SERVERDIAGNOSTICS,WEBTEST"
$SN = " SERVICEUSERNAME="
$SP = " SERVICEPASSWORD="
$REBOOT = " REBOOT=ReallySurpress"

; Combine Variables to build Command Line
$CMDS = @SystemDir & $Setup & $LOG & $INSTALLTYPE & $INSTALLDIR & $ADDLOCAL1 & $ADDLOCAL2 & $SN & $Secret1 & $SP & $Secret2 & $REBOOT

; Run Program with Command Lines
ShellExecuteWait($CMDS)

Thanks

Terry

First >> $InstallDir does not look correct. Too many double quotes.

Change ShellExecuteWait( to MsgBox(4096,"Command, $Cmd) and see what is returned in the message box. Does it look identical to the command you need. I think you will find there are quotes that are not required. If you need some of those quotes to remain in place then surround that string with single quotes instead of double.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

First >> $InstallDir does not look correct. Too many double quotes.

Change ShellExecuteWait( to MsgBox(4096,"Command, $Cmd) and see what is returned in the message box. Does it look identical to the command you need. I think you will find there are quotes that are not required. If you need some of those quotes to remain in place then surround that string with single quotes instead of double.

Thanks,

Actually the command line is correct I think.

$INSTALLDIR = " INSTALLDIR=\""D:\Program Files\Corillian\Voyager\"""

becomes

INSTALLDIR=\"D:\program files\corillian\voyager\"

Here's the command line I need:

voyager3.2.1.exe /s /v"/qn /L*v %temp%\Voyager32setup.log INSTALLTYPE=NEW INSTALLDIR=\"D:\Program Files\Corillian\Voyager\" ADDLOCAL=COREFILES,VOYAGER_AT,TP,HS,VLOGSERVICE,AUTHENTICATIONCLIENT,AUTHORIZATIONCLIENT,TPCLIENT,HO

STSCRIPTER,SERVERDIAGNOSTICS,WEBTEST SERVICEUSERNAME=LAB3B\*** SERVICEUSERPASSWORD=*** REBOOT=ReallySuppress"

When I output to a msgbox that's what I see.

Plus It is saying that it can't find my exe, not that the command line for installing is incorrect?

So I think there must be something about the shellexecutewait when its passed variables that it's not getting the right path?? Maybe it needs so quotes around the $CMDS? I did try that though and it gave me the same error about not being able to find the exe.

post-3866-1175797628_thumb.jpg

Edited by mattw112

Share this post


Link to post
Share on other sites

Also if I use a runwait instead of shellexecutewait, I don't get an error message but it also doesn't do anything.

Share this post


Link to post
Share on other sites

Also I just tried the single quote thing as well and got the same thing.

Share this post


Link to post
Share on other sites

Also I just tried the single quote thing as well and got the same thing.

It's not finding voyager3.2.1.. Is that file actually in @SystemDir as specified in the shellEecute (@SystemDir & $Setup)?

Again use a message box to isolate your problem.

If FileExists(@SystemDir & $Setup) Then

$MbTxt = "The file is where I said it was"

Else

$MbTxt = "Ooops! I messed up the path"

EndIf

MsgBox(4096,"",$MbTxt)

Also why would you want to use ShellExecute(@SystemDir & $Setup &.........) anyway?

$SetUp = @SystemDir & "\Voyager3.2.1.exe /s /v""/qn"

ShellExecute($SetUp &......................)


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

It's not finding voyager3.2.1.. Is that file actually in @SystemDir as specified in the shellEecute (@SystemDir & $Setup)?

Again use a message box to isolate your problem.

If FileExists(@SystemDir & $Setup) Then

$MbTxt = "The file is where I said it was"

Else

$MbTxt = "Ooops! I messed up the path"

EndIf

MsgBox(4096,"",$MbTxt)

Also why would you want to use ShellExecute(@SystemDir & $Setup &.........) anyway?

$SetUp = @SystemDir & "\Voyager3.2.1.exe /s /v""/qn"

ShellExecute($SetUp &......................)

See Screen Capture. The file is where I said it was...

As for why? I guess I don't know. I tried both shellexecutewait and runwait. Is there another option?

I really think this is going to come down to the use of ' and " and where they are placed. Does anyone see any issues with the way I have set mine?

Thanks,

Terry

post-3866-1175804245_thumb.jpg

Share this post


Link to post
Share on other sites

See Screen Capture. The file is where I said it was...

As for why? I guess I don't know. I tried both shellexecutewait and runwait. Is there another option?

I really think this is going to come down to the use of ' and " and where they are placed. Does anyone see any issues with the way I have set mine?

Thanks,

Terry

OK Next step

Change $Setup to the way I showed in my last reply

Change $InstDir to' INSTALLDIR=\"D:\Program Files\Corillian\Voyager\"' ;; I'm hesitant to use FileGetShortName here but that's another option

;; In that case it would be $InstDir = " INSTALLDIR=\" & FileGetShortName("D:\Program Files\Corillian\Voyager\")

Again use the msgbox to check $Setup & $InstDir

Add the rest of the parameters into your message box 1 at a time and see if it is still correct.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Here's the command line I need:

voyager3.2.1.exe /s /v"/qn /L*v %temp%\Voyager32setup.log INSTALLTYPE=NEW INSTALLDIR=\"D:\Program Files\Corillian\Voyager\" ADDLOCAL=COREFILES,VOYAGER_AT,TP,HS,VLOGSERVICE,AUTHENTICATIONCLIENT,AUTHORIZATIONCLIENT,TPCLIENT,HO

STSCRIPTER,SERVERDIAGNOSTICS,WEBTEST SERVICEUSERNAME=LAB3B\*** SERVICEUSERPASSWORD=*** REBOOT=ReallySuppress"

If you Remark this line ShellExecuteWait($CMDS) and then add ConsoleWrite($CMDS & @CRLF) you see that you are missing the last double quote. Also I will break it down into Program, Switches and wroking directory ShellExecuteWait($CMDS, $SWITCHES, @ScriptDir).

Give it a try:

; Execute Program using Secrets that were found
; First break down the command line so it is easier to read:

$SETUP = "\Voyager3.2.1.exe"
$LOG = "/s /v""/qn /L*v %temp%\Voyager321Setup.log"
$INSTALLTYPE = " INSTALLTYPE=NEW"
$INSTALLDIR = " INSTALLDIR=\""D:\Program Files\Corillian\Voyager\"""
$ADDLOCAL1 = " ADDLOCAL=COREFILES,VOYAGER_AT,TP,HS,VLOGSERVICE,AUTHENTICATIONCLIENT,AUTHORIZATIONCLIENT,"
$ADDLOCAL2 = "TPCLIENT,HOSTSCRIPTER,SERVERDIAGNOSTICS,WEBTEST"
$SN = " SERVICEUSERNAME="
$SP = " SERVICEPASSWORD="
$REBOOT = ' REBOOT=ReallySurpress"'

; Combine Variables to build Command Line
$CMDS = @SystemDir & $Setup  
$SWITCHES = $LOG & $INSTALLTYPE & $INSTALLDIR & $ADDLOCAL1 & $ADDLOCAL2 & $SN & $Secret1 & $SP & $Secret2 & $REBOOT

; Run Program with Command Lines
ShellExecuteWait($CMDS, $SWITCHES, @ScriptDir)
Edited by Danny35d

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

If you Remark this line ShellExecuteWait($CMDS) and then add ConsoleWrite($CMDS & @CRLF) you see that you are missing the last double quote. Also I will break it down into Program, Switches and wroking directory ShellExecuteWait($CMDS, $SWITCHES, @ScriptDir).

Give it a try:

; Execute Program using Secrets that were found
; First break down the command line so it is easier to read:

$SETUP = "\Voyager3.2.1.exe"
$LOG = "/s /v""/qn /L*v %temp%\Voyager321Setup.log"
$INSTALLTYPE = " INSTALLTYPE=NEW"
$INSTALLDIR = " INSTALLDIR=\""D:\Program Files\Corillian\Voyager\"""
$ADDLOCAL1 = " ADDLOCAL=COREFILES,VOYAGER_AT,TP,HS,VLOGSERVICE,AUTHENTICATIONCLIENT,AUTHORIZATIONCLIENT,"
$ADDLOCAL2 = "TPCLIENT,HOSTSCRIPTER,SERVERDIAGNOSTICS,WEBTEST"
$SN = " SERVICEUSERNAME="
$SP = " SERVICEPASSWORD="
$REBOOT = ' REBOOT=ReallySurpress"'

; Combine Variables to build Command Line
$CMDS = @SystemDir & $Setup  
$SWITCHES = $LOG & $INSTALLTYPE & $INSTALLDIR & $ADDLOCAL1 & $ADDLOCAL2 & $SN & $Secret1 & $SP & $Secret2 & $REBOOT

; Run Program with Command Lines
ShellExecuteWait($CMDS, $SWITCHES, @ScriptDir)
Hi Thanks!

I noticed the missing quotes a while back and edited my original post, not sure if that's the one you were looking at or not?

I will give this a try, so with ShellExecuteWait you can do the switches seperately? after the $CMDS, ... I didn't see that! Duh... I'll bet that works. For some reason I didn't realize parameters=switches.

Thanks Again,

Terry

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Hi Thanks!

I noticed the missing quotes a while back and edited my original post, not sure if that's the one you were looking at or not?

Thanks Again,

Terry

Yes it is, I didn't realize I was using the code from post #2 :shocked:

Anyway your welcome.

Edited by Danny35d

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

OK, So I tried your suggestion with the shellexecutewait($setup, $cmds, ...) and it worked great.

I also made some of the other changes suggested in this thread (like when to use ' or "). So now I have the following which seems to work great:

; Execute Program using Secrets that were found
; First break down the command line so it is easier to read
$SETUP = "%temp%\Voyager3.2.1.exe"
$LINE = ' /s /v"/qn'
$LOG = ' /L*v %temp%\Voyager321Setup.log'
$INSTALLTYPE = ' INSTALLTYPE=NEW'
$INSTALLDIR = ' INSTALLDIR=\"D:\Program Files\Corillian\Voyager\"'
$ADDLOCAL1 = ' ADDLOCAL=COREFILES,VOYAGER_AT,TP,HS,VLOGSERVICE,AUTHENTICATIONCLIENT,AUTHORIZATIONCLIENT,'
$ADDLOCAL2 = 'TPCLIENT,HOSTSCRIPTER,SERVERDIAGNOSTICS,WEBTEST'
$SN = ' SERVICEUSERNAME='
$SP = ' SERVICEPASSWORD='
$REBOOT = ' REBOOT=ReallySurpress"'

; Combine Variables to build Command Line
$CMDS = $LINE & $LOG & $INSTALLTYPE & $INSTALLDIR & $ADDLOCAL1 & $ADDLOCAL2 & $SN & $Secret1 & $SP & $Secret2 & $REBOOT

; Run Program with Command Lines
ShellExecuteWait($SETUP, $CMDS, @ScriptDir)

Thanks!

Terry

Edited by mattw112

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
Sign in to follow this  
Followers 0