Jump to content

[SOLVED] Run and unbalanced brackets


Recommended Posts

Hi, it's me again...

I'm going crazy, i'm lost 2hr...i have used Run 10000 time but this time i have problem with the brackets

Script, with this paramenter work

$exe = "C:\test_x86.exe"
$install = "install"
$exe2 = @WorkingDir & "\test2_x86.exe"
$root = "root\test"
RunWait(@ComSpec & " /k " & $exe & " " & $install & " " & '"' & $exe2 & '"' & " " & $root, @WorkingDir)

But i need to use macro for the $exe

$exe = "C:\test_x86.exe" ; Need to use @WorkingDir

So i have make this:

$exe = @WorkingDir & "\test_x86.exe"
$install = "install"
$exe2 = @WorkingDir & "\test2_x86.exe"
$root = "root\test"
RunWait(@ComSpec & " /k " & '"' & $exe & '"' & " " & $install & " " & '"' & $exe2 & '"' & " " & $root, @WorkingDir)

But not work, give me error C:\Documents is a wrong path etc...classic error by path with space without brackets

Do you know what is the funniest part? If i make:

ConsoleWrite('"' & $exe & '"' & " " & $install & " " & '"' & $exe2 & '"' & " " & $root)

And i copy/paste the result in a CMD window work...

What is my error?

Thanks

Edited by johnmcloud
Link to comment
Share on other sites

What is variable $devcon_x86 used for? I can't find it in your script.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

When you replace RunWait with ConsoleWrite and remove the @WorkingDir parameter you get:

Consolewrite(@ComSpec & " /k " & '"' & $exe & '"' & " " & $install & " " & '"' & $exe2 & '"' & " " & $root)
.

This writes the complete string to the console. I get:

C:Windowssystem32cmd.exe /k "C:Temptest_x86.exe" install "C:Temptest2_x86.exe" roottest
which doesn't look bad.

What do you get?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

This is what i get:

C:\Windows\System32\cmd.exe /k "C:Documents and SettingsMYNAMEDesktopTestTest_x86.exe" install "C:Documents and SettingsMYNAMEDesktopTestTest2_x86.exe" roottest

As i have told you, if i copy-paste in cmd work, but with autoit the cmd output give me:

"C:Documents" is not recognized as an internal or external command, operable program or batch file.
Link to comment
Share on other sites

  • Developers

Try:

RunWait(@ComSpec & ' /k ""' & $exe & '" ' & $install & ' "' & $exe2 & '" ' & $root & '"', @WorkingDir)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Try it the other way round:

RunWait(@ComSpec & " /k " & "'" & $exe & "'" & " " & $install & " " & "'" & $exe2 & "'" & " " & $root, @WorkingDir)
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

@Jos, the result is:

""C:Documents and SettingsMYNAMEDesktopTestTest_x86.exe"" is not recognized as an internal or external command, operable program or batch file.

Cool, now i have four brackets :D

@Water instead:

The syntax of the file name, directory or volume is incorrect.
Edited by johnmcloud
Link to comment
Share on other sites

  • Developers

Cool, now i have four brackets :D

You mean Double Quotes ;)

I have see this before and know that enclosing the whole commandline with an extra set of double quotes did resolve it sometimes.

You are running this under the same credentials right?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

@Water instead:

The syntax of the file name, directory or volume is incorrect.

Could we just start the exe so we can see if the message comes from the OS or the application:

RunWait(@ComSpec & " /k " & "'" & $exe & "'", @WorkingDir)
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

@Water

Same error, so:

The syntax of the file name, directory or volume is incorrect.

If i make this work:

$exe = "C:Test_x86.exe"
RunWait(@ComSpec & " /k " & $exe, @WorkingDir)

With the quotes no...

EDIT: Like this work:

RunWait(@ComSpec & " /k " & '"' & $exe & '"', @WorkingDir)

But if i add the second parameter ( the parameter has space inside ) i have the error C:Documents

Edited by johnmcloud
Link to comment
Share on other sites

Runwait(@ComSpec & " /k " & '"' & $exe & '"')
works here with Windows 7 64 bit.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

@Water

It's not OS problem,if i make another tipe of command like:

@ComSpec & " /c " & '"' & $exe & '" ' & $uninstall & " " & $root

Work fine, or if i make the first or second parameter without " " and space work:

$exe = @WorkingDir & "test_x86.exe"
$install = "install"
$exe2 = "C:test2_x86.exe"
$root = "roottest"
RunWait(@ComSpec & " /k " & '"' & $exe & '" ' & $install & " " & $exe2 & " " & $root, @WorkingDir)

So if i have two path with space and " " inside the same Run not work

Edited by johnmcloud
Link to comment
Share on other sites

Another question:

You start $exe to install or uninstall $exe2?

You would then have at least 2 levels of programs started by RunWait: Cmd.exe -> $exe

No wonder that it gets complex.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

YEAH!

I have make totally random quotes until Autoit accept it lol

$exe = '""' & @WorkingDir & "\Test_x86.exe" & '"'
$install = "install"
$exe2 = '"' & @WorkingDir & "\Test2_x86.exe\" & '""'
$root = "root\test"
RunWait(@ComSpec & " /k " & " " & $exe & " " & $install & " " & $exe2 & " " & $root, @WorkingDir)

Thanks for the support Water and Jos

Link to comment
Share on other sites

Glad you got it working :D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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

×
×
  • Create New...