If you want to edit a specific line in a file through VBScript you can use something like below. This reads the original file line by line and writes it out to a temporary file. If the original line meets the condition you want, make the changes required. At the end, close both files, delete [...]
Posts Tagged ‘VBScript’
VBScript edit line in file
Posted in VBScript, Work, tagged edit, file, rename, VBScript on September 9, 2008 | 6 Comments »
VBScript get MSI ProductCode
Posted in Packaging, VBScript, Work, tagged msi, VBScript, WindowsInstaller on August 20, 2008 | 1 Comment »
In looking for a way to retrieve the ProductCode from an MSI I came across this. Two important points: One, this uses the windows installer object and can be queried using SQL effectively, Two, the different parameters for opening the database can be found in the MSDN, but I found 2 worked better than 0.
Function GetMSIProductCode(msi) [...]
VBScript – get file version
Posted in VBScript, Work, tagged VBScript on July 22, 2008 | Leave a Comment »
I was looking for a way to find a file version with vbscript and found this, which should work for .dlls and .exes:
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
file = “C:\windows\file.exe”
Wscript.Echo objFSO.GetFileVersion(file)
Easy!
Sweet VBScript – command line parameters
Posted in VBScript, Work, tagged command line, parameter, switch, VBScript on January 10, 2008 | 2 Comments »
Something neat I did was working with command line parameters in VBScript. You can access the command line arguments array through
Wscript.Arguments(i)
where i goes from 0 upwards. So, if you’ve got one argument option you could handle it like this
If Wscript.Arguments.Count = 0 Then
‘ Do Proceed as Normal
Else
If Wscript.Arguments(0) = “/something” Then
RunFunctionA
End If
End If
If [...]