Sign in to follow this  
Followers 0
ziongates

Quotes around Variables for shellexecute

5 posts in this topic

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)

Share this post


Link to post
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 &'"')

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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.

No... you have to use the & sign. It isn't that big of a deal.

Share this post


Link to post
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)

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