Convert VBScript to Batch File

Hi there,

I need to convert the following script that I think is VBScript, to a Batch File.

Thanks for your help,


Public Sub SoftwareInformationVBS(ByVal strComputer As String, ByVal strUserName As String, ByVal strPwd As String)   
        Dim objWMIService, objFSO, objTextFile, colSoftware, objSoftware, objSWbemLocator   
            objFSO = CreateObject("Scripting.FileSystemObject")   
            objTextFile = objFSO.CreateTextFile("c:\software.txt", True)   
            objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")   
            If (strComputer = Environment.MachineName.ToString) Then  
                objWMIService = objSWbemLocator.ConnectServer(strComputer, "root\cimv2")   
                objWMIService = objSWbemLocator.ConnectServer(strComputer, "root\cimv2", strUserName, strPwd)   
            End If  
            objWMIService.Security_.ImpersonationLevel = 3   
            colSoftware = objWMIService.ExecQuery("Select * from Win32_Product")   
            objTextFile.WriteLine("Caption" & vbTab & _   
                "Description" & vbTab & "Identifying Number" & vbTab & _   
                "Install Date" & vbTab & "Install Location" & vbTab & _   
                "Install State" & vbTab & "Name" & vbTab & _   
                "Package Cache" & vbTab & "SKU Number" & vbTab & "Vendor" & vbTab _   
                    & "Version")   
            For Each objSoftware In colSoftware   
                objTextFile.WriteLine(objSoftware.Caption & vbTab & _   
                objSoftware.Description & vbTab & _   
                objSoftware.IdentifyingNumber & vbTab & _   
                objSoftware.InstallDate2 & vbTab & _   
                objSoftware.InstallLocation & vbTab & _   
                objSoftware.InstallState & vbTab & _   
                objSoftware.Name & vbTab & _   
                objSoftware.PackageCache & vbTab & _   
                objSoftware.SKUNumber & vbTab & _   
                objSoftware.Vendor & vbTab & _   
        Catch ex As Exception   
        End Try  
End Sub  

Open in new window

LVL 10
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewIT / Software Engineering ConsultantCommented:
How about this?
wmic product get Caption,Description,IdentifyingNumber,InstallDate2,InstallLocation,InstallState,Name,PackageCache,SKUNumber,Vendor,Version /format:csv >c:\software.txt

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ReneGeAuthor Commented:
And why didn't I think of this one??
Thanks Bill!!
Bill PrewIT / Software Engineering ConsultantCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.