clivebuckwheat Posted September 30, 2012 Share Posted September 30, 2012 (edited) I have a vbs that installed Photoshop elements 10.This cmd file works fine and Photoshop elements 10, the program installs silently perfect.start/wait Setup.exe /UL1033 /V"SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244"Then I put the same command above in a vbs script because it adds some success codes for when I am using SCCM and Photoshop elements no longer silently installs. The installations starts and it all becomes manual.Set sho = Wscript.CreateObject("Wscript.Shell")strCommand = "Setup.exe /UL1033 /V'SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244'"intRet = sho.run(strCommand,0,True)If intRet = 3010 Or intRet = 255 Then intRet = 0End Ifwscript.quit(intRet) Edited September 30, 2012 by clivebuckwheat Link to comment Share on other sites More sharing options...
gunsmokingman Posted September 30, 2012 Share Posted September 30, 2012 You have only one of the below at the end before the quote mark ,could that becausing the problem'COUNTRY=244'"If you need a area double quoted use Chr(34) = " Test VBS I used to test the strrCommand'strCommand = " Setup.exe /UL1033 /V"SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244'"strCommand = "Setup.exe /UL1033 /V" & Chr(34) & "SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244" & Chr(34)WScript.Echo strcommandChange From strCommand = " Setup.exe /UL1033 /V"SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244'"The above errors out at the /V" because it missing the matching "Chage TostrCommand = "Setup.exe /UL1033 /V" & Chr(34) & "SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244" & Chr(34)How the Change To would be read at run timeSetup.exe /UL1033 /V"SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244" Link to comment Share on other sites More sharing options...
clivebuckwheat Posted September 30, 2012 Author Share Posted September 30, 2012 You have only one of the below at the end before the quote mark ,could that becausing the problem'COUNTRY=244'"If you need a area double quoted use Chr(34) = " Test VBS I used to test the strrCommand'strCommand = " Setup.exe /UL1033 /V"SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244'"strCommand = "Setup.exe /UL1033 /V" & Chr(34) & "SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244" & Chr(34)WScript.Echo strcommandChange From strCommand = " Setup.exe /UL1033 /V"SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244'"The above errors out at the /V" because it missing the matching "Chage TostrCommand = "Setup.exe /UL1033 /V" & Chr(34) & "SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244" & Chr(34)How the Change To would be read at run timeSetup.exe /UL1033 /V"SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244"thanks strCommand = "Setup.exe /UL1033 /V" & Chr(34) & "SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244" & Chr(34)Works the install is silent again.You said I am missing a " in my original vbs script above. Where? I really don't see it Here is the original againSet sho = Wscript.CreateObject("Wscript.Shell")strCommand = "Setup.exe /UL1033 /V'SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244'"intRet = sho.run(strCommand,0,True)If intRet = 3010 Or intRet = 255 Then intRet = 0End Ifwscript.quit(intRet) Link to comment Share on other sites More sharing options...
jaclaz Posted September 30, 2012 Share Posted September 30, 2012 Then I put the same command above in a vbs script It seems to me like being NOT the same:in the batch:Setup.exe /UL1033 /V doublequote SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244 doublequotein the VBS:doublequote Setup.exe /UL1033 /V singlequote SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244 singlequote doublequotejaclaz Link to comment Share on other sites More sharing options...
gunsmokingman Posted September 30, 2012 Share Posted September 30, 2012 Then I put the same command above in a vbs script It seems to me like being NOT the same:in the batch:Setup.exe /UL1033 /V doublequote SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244 doublequotein the VBS:doublequote Setup.exe /UL1033 /V singlequote SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244 singlequote doublequotejaclazYou are wrongThis is how it interpids the line at runtime on the second line of the Example scriptSetup.exe /UL1033 /V "SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244"The quotes are remove when it being process by the script, when it see a double "" it only read one. Chr(34) = " so it knows the serial numberhas quotes around it. strCommand = "Setup.exe /UL1033 /V" & Chr(34) & "SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244" & Chr(34) When the script process the line it checks to make sure there none of " these are missingIn his original script he was trying to double quote EX "Sting In Quotes" so the scriptwill read it like Sting In Quotes where as he needs it to be read as "Sting In Quotes" Clive can you see what wrong here244'"244" Link to comment Share on other sites More sharing options...
jaclaz Posted September 30, 2012 Share Posted September 30, 2012 You are wrongNo, I am not, I only read what clivebuckwait posted:Here is the original againSet sho = Wscript.CreateObject("Wscript.Shell")strCommand = "Setup.exe /UL1033 /V'SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244'"Which actually is:doublequote Setup.exe /UL1033 /V singlequote SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244 singlequote doublequoteand is ACTUALLY DIFFERENT from what he initially posted as the batch line, which still remains:Setup.exe /UL1033 /V doublequote SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244 doublequoteI don't know (or care) how VBS parses the posted lines, I only highlighted how the two are NOT the same (nothing more, nothing less).jaclaz Link to comment Share on other sites More sharing options...
gunsmokingman Posted September 30, 2012 Share Posted September 30, 2012 Cmd line it not wrapped in quotesstart/wait Setup.exe /UL1033 /V"SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244"VBS requires quotes around the string or the string would be read like a varible that empty"Setup.exe /UL1033 /V" & Chr(34) & "SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244" & Chr(34)Interpid this way by Cscript.exe or Wscript.exeHis CodeSetup.exe /UL1033 /VMy CodeSetup.exe /UL1033 /V"SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244"MsgBox "Line 1 " & Some & Text & vbCrLf & "Line 2 Some Text",4128,"Test"will produce---------------------------Test---------------------------Line 1 Line 2 Some Text---------------------------OK ---------------------------His origianl script was failing because he did not have it quoted correct Link to comment Share on other sites More sharing options...
jaclaz Posted October 1, 2012 Share Posted October 1, 2012 His origianl script was failing because he did not have it quoted correctI know , that's why I highlighted the conceptual error of stating that the two command lines were the same.jaclaz Link to comment Share on other sites More sharing options...
gunsmokingman Posted October 1, 2012 Share Posted October 1, 2012 I always find it easier to enclose a string with double quotes using the VBS Chr(34) then trying to count how many quotes are needed.A Way without Chr(34)strCommand = "Setup.exe /UL1033 /V""SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244"""ProducesSetup.exe /UL1033 /V"SERIALNUMBER=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx COUNTRY=244" Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now