Jump to content
Sign in to follow this  
CarlD

Quotes around string

Recommended Posts

CarlD

Help me out here, please. I'm reading input from an ini file, which I then want to pass to ShellExecute().

The ini file entry is:

E="C:\Program Files\Just Great Software\EditPad Pro 7\EditPadPro7.exe"

When I read this into var $KeyValue, the variable contains C:\Program Files\Just Great Software\EditPad Pro 7\EditPadPro7.exe -- no quotes.

Okay. So I change the ini entry to:

E='"C:\Program Files\Just Great Software\EditPad Pro 7\EditPadPro7.exe"' -- double quotes wrapped in single quotes.

$KeyValue now contains: "C:\Program Files\Just Great Software\EditPad Pro 7\EditPadPro7.exe" -- with double quotes, as desired. Before I pass this string to ShellExecute(), however, I want to hand it off to another variable, $I. However, when I do $I = $KeyValue, $I again returns C:\Program Files\Just Great Software\EditPad Pro 7\EditPadPro7.exe -- no quotes. Gah!

So how do I get quotes to "stick" to a string saved in a variable?

PS: I really don't want to change the ini entry, because the ini file is used by other programs.

Edited by CarlD

Share this post


Link to post
Share on other sites
iamtheky

What you believe is happening, is not happening.  Post your code, something else is stripping quotes.

$KeyValue = '"C:\Program Files\Just Great Software\EditPad Pro 7\EditPadPro7.exe"'
msgbox(0, '' , $KeyValue)
$new = $KeyValue
msgbox(0, '' , $new)

 


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
CarlD

... something else is stripping quotes.

$KeyValue = '"C:\Program Files\Just Great Software\EditPad Pro 7\EditPadPro7.exe"'
msgbox(0, '' , $KeyValue)
$new = $KeyValue
msgbox(0, '' , $new)

 

​You're right. Another part of my code -- too tedious to post -- was stripping out the quotes when it shouldn't have (fixed).

Many thanks for setting me straight.

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  

×