how to write setlang.vbs
- Hi,
- Download the .vbs script from here: setlang.vbs and don't know how to write it, & when i try to run from command i am getting below error. Please help me to solve this problem
- C:\Users\roopesh\Desktop\setlang.vbs(4, 32) Microsoft VBScript compilation error: Expected end of statement.
- here is the setlan.vbs file content copied for your reference. please correct if i am wrong.
- Dim argCount : argCount = Wscript.Arguments.Count
- If (argCount < 2) Then
- Wscript.Echo "setlang.vbs - Modify the package language field of an MSI installer file" & vbNewLine & vbNewLine & _
- "usage: cscript setlang.vbs "c:\Users\roopesh\Desktop\ampagent-5.4.10622-86_srvdc01.aosmithindia.com.msi 1033" & vbNewLine & vbNewLine & _
- "example: cscript setlang.vbs C:\temp\ampagent-5.4.1000-x86.msi 1033" & vbNewLine & vbNewLine & _
- "Copyright (C) 2012 Dell Inc. All rights reserved."
- Wscript.Quit 1
- End If
- Dim dbPath : dbPath = Wscript.Arguments(0)
- Dim lcid : lcid = Wscript.Arguments(1)
- On Error Resume Next
- Dim installer : Set installer = Nothing
- Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError
- Dim database : Set database = installer.OpenDatabase(dbPath, 1) : CheckError
- Dim sumInfo : Set sumInfo = database.SummaryInformation(1) : CheckError
- Dim template : template = sumInfo.Property(7) : CheckError
- Dim iDelim : iDelim = InStr(1, template, ";", vbTextCompare)
- Dim platform : If iDelim = 0 Then platform = ";" Else platform = Left(template, iDelim)
- sumInfo.Property(7) = platform & lcid
- sumInfo.Persist : CheckError
- database.Commit : CheckError
- Set database = nothing
- Wscript.Echo "Successfully set package language = " & lcid
- Wscript.Quit 0
- Sub CheckError
- Dim msg, errRec
- If Err = 0 Then Exit Sub
- msg = Err.Source & " " & Hex(Err) & ": " & Err.Description
- If Not installer Is Nothing Then
- Set errRec = installer.LastErrorRecord
- If Not errRec Is Nothing Then msg = msg & vbNewLine & errRec.FormatText
- End If
- Wscript.Echo msg
- Wscript.Quit 2
- End Sub
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
LBarclay
10 years ago
I'm not quite sure what your trying to do as the question is a little vague, but you need to righ-click on the .vbs and choose "Edit" This will allow you to change the VBS for the KACE agent as explained in the instruction.
Does that help? If not could you add a bit more information and restructure the question?
Thanks!