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.
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:
Is that right or wrong? If it's wrong, can someone show me the correct placement of quotations.
Thanks.
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)
Please log in to answer
Posted by:
Garrett
19 years ago
Posted by:
TomB
19 years ago
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:
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
19 years ago
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.
This is what ended up making it work.
Once again, thanks. This is a great resource for my new job requirements. :)
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
16 years ago
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!
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
16 years ago
ORIGINAL: JollyBut 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:
Simply quote your quotes!
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.
so that the conversation will remain readable.