Running a command using vbscript with muliple quotes

Hello,

I'm trying to run this simple command using vbscript.

psshutdown.exe -r -m "System is shutting down"

I'm having trouble in Vbscript using the WshShell.Run method because of the additonal quotation marks needed.

I've played around with Chr(34) but still can't get it to work at all.

Any ideas on how I can take the following code and make it work. The -m switch is for the shutdown message. The shutdown message has to be in quotes too.

Set wshShell = CreateObject("WScript.Shell")
wshShell.Run "PsShutdown.exe -r -m "System is shutting down now""

Thanks
hpopsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hongjunCommented:
Try this

Dim myCommand

myCommand = "PsShutdown.exe -r -m ""System is shutting down now"""
wshShell.Run myCommand
hongjunCommented:
Use 2 quotes to represent 1 quote
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
So this doesnt' work?

    wshShell.Run "PsShutdown.exe -r -m " & Chr(34) & "System is shutting down now" & Chr(34)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Leo EikelmanDirector, IT and Business DevelopmentCommented:
Try

Dim sysShutdown as String

sysShutdown = "System is shutting down now"

wshShell.Run "PsShutdown.exe -r -m " & sysShutdown

hpopsAuthor Commented:
Thanks to both of you. Both methods work and give me a choice on which direction to take. I like both solutions but for my needs this time around Idle Mind's solution fits me a bit better. I like hongjun's method too because it will come in handy for another project I'm working on.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.