Jump to content

Quotes around Variables for shellexecute


Recommended Posts

I'm writing scripts which result in running external programs which are passed arguments wrapeed in variables. The variables need to be in quotes. Is there an easier way to accomplish this than my messy code below? Specifically line $command where I have ($quote & $picture & $quote)

$Picture = "E:\Timunah\§ Writers Conference\These\Smaller\Majestic Artz 13.jpg"

$quote = ('"')

$command = ($quote & $Picture & $quote)

ShellExecute ("C:\Ancient\Indesign\Indesign Place.vbs", $command)

Link to comment
Share on other sites

I'm writing scripts which result in running external programs which are passed arguments wrapeed in variables. The variables need to be in quotes. Is there an easier way to accomplish this than my messy code below? Specifically line $command where I have ($quote & $picture & $quote)

$Picture = "E:\Timunah\§ Writers Conference\These\Smaller\Majestic Artz 13.jpg"

$quote = ('"')

$command = ($quote & $Picture & $quote)

ShellExecute ("C:\Ancient\Indesign\Indesign Place.vbs", $command)

Like so?

Run ('C:\Ancient\Indesign\Indesign Place.vbs "' & $quote & $picture & $quote &'"')

Link to comment
Share on other sites

Like so?

Run ('C:\Ancient\Indesign\Indesign Place.vbs "' & $quote & $picture & $quote &'"')

Not really, specifically is there a way to insert quotes around my variables without creating a variable for the quote and using the "&" sign everytime I need to implement it.

Link to comment
Share on other sites

You can just nest the double quotes inside single quotes.

$Picture = '"E:\Timunah\§ Writers Conference\These\Smaller\Majestic Artz 13.jpg"'

ShellExecute ("C:\Ancient\Indesign\Indesign Place.vbs", $Picture)

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