Jump to content

Invoking PS scripts using single and double quotes


Recommended Posts

I send a string Sun is shining, the weather is sweet to my Powershell script for converting text to JSON request and then to speech.

This snippet works as intended:

$CMD = "powershell " & $powershellScript & " -Text '" & $sText & "' -Path " & $outputFile[1] & ".wav"
$execCommand = Run($CMD, '' , @SW_HIDE, 0x2)

This one differs only by single quotes:

$CMD = 'powershell ' & $powershellScript & ' -Text "' & $sText & '" -Path ' & $outputFile[1] & '.wav'
$execCommand = Run($CMD, '' , @SW_HIDE, 0x2)

And only the first word Sun is voiced for some reason.

I wonder why is it so and is it on Autoit side or PS/JSON?

Link to comment
Share on other sites

  • Developers

Just look at the resulting $CMD and try them from the CMD window to see why they act differently. :)

Jos

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

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