Feeds:
Posts
Comments

Posts Tagged ‘VBScript’

VBScript edit line in file

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 [...]

Read Full Post »

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) [...]

Read Full Post »

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!

Read Full Post »

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 [...]

Read Full Post »