/build/static/layout/Breadcrumb_cap_w.png

VBScript Quotation Usage

I'm trying to get this VBScript working, but the quotation marks needed are throwing me off. I was hoping I could get some help with the placement of quotations.

Set WshShell = CreateObject("WScript.Shell")
' Uninstall Adobe 5 Reader
WshShell.Run ISUNINST.EXE -y -a -f"C:\Program Files\Common Files\Adobe\Acrobat 5.0\NT\Uninst.isu",1,True


Right now, that command is how it should be formatted if I was inserting it into a batch file. I know there needs to be a lot more quotations, but I'm not exactly sure where. I think there are a pair that go around ISUNINST.EXE and I think the parameter passed to that command needs 3 pairs because of the space in the path, but the middle options are what have me thrown for a loop right now.

If I was going to guess, ths is how I would guess:


WshShell.Run "ISUNINST.EXE" -y -a -f"""C:\Program Files\Common Files\Adobe\Acrobat 5.0\NT\Uninst.isu""",1,True


Is that right or wrong? If it's wrong, can someone show me the correct placement of quotations.

Thanks.

0 Comments   [ + ] Show comments

Answers (5)

Posted by: Garrett 18 years ago
Orange Belt
0

Set WshShell = CreateObject("WScript.Shell")
' Uninstall Adobe 5 Reader
WshShell.Run "ISUNINST.EXE -y -a -f" & Chr(34) & "C:\Program Files\Common Files\Adobe\Acrobat 5.0\NT\Uninst.isu" & Chr(34),1,True


Chr(34) = "
Posted by: TomB 18 years ago
Orange Belt
0
The best thing to use is Chr(34), That is the ASCII code for ". You may also need the path to the ISUNINST.EXE file.

So for example:

Dim WshShell
Dim command
Dim WindowsFolder,CommonFiles

Set WshShell = CreateObject("WScript.Shell")
WindowsFolder = wso.ExpandEnvironmentStrings("%SystemRoot%")
CommonFiles = wso.ExpandEnvironmentStrings("%CommonProgramFiles%")

Command = WindowsFolder & "\ISUNINST.EXE -y -a -f" & Chr(34) & CommonFiles & "\Adobe\Acrobat 5.0\NT\Uninst.isu" & Chr(34)

WshShell.Run Command,1,True
Posted by: sigtau66 18 years ago
Senior Yellow Belt
0
Thanks for the replies. I had read some other posts about the Chr(34), but wasn't sure about it's placement.

Well, without that, I continued to play with the quotation placement and finally got it before I read your responses.

WshShell.Run "ISUNINST.EXE -y -a -f""C:\Program Files\Common Files\Adobe\Acrobat 5.0\NT\Uninst.isu""",1,True

This is what ended up making it work.

Once again, thanks. This is a great resource for my new job requirements. :)
Posted by: Jolly 15 years ago
Yellow Belt
0
Finally got the hang of this myself.

Lets break this command down. The /v switch tells the installer to use msiexec switches for the wrapped msi file.
setup32.exe /S /v"/passive/ REBOOT=REALLYSUPPRESS"

First of all we need to quation mark the full command

"setup32.exe /S /v"/passive/ REBOOT=REALLYSUPPRESS""
At this point the VB script doesnt understand the "/passive/ REBOOT=REALLYSUPPRESS"

What we have to do is to put another pair of quotation marks around it like below.
""/passive/ REBOOT=REALLYSUPPRESS""

If we put it togheter it will look like this.
"setup32.exe /S /v""/passive/ REBOOT=REALLYSUPPRESS"""

Simply quote your quotes!
Posted by: anonymous_9363 15 years ago
Red Belt
0
ORIGINAL: Jolly
Simply quote your quotes!
But can you see how hard that it is to read, especially for blind old duffers like me? Using Chr(34) - that is, the ASCII character for quote mark - makes it crystal-clear what's going on, so that the actual quote marks in the script enclose strings and the quote marks required by the command line are clearly defined:

strCommandLine = "setup32.exe /S /v" & Chr(34) & "/passive/ REBOOT=REALLYSUPPRESS" & Chr(34)
objShell.Run strCommandLine
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ