rene
Hello. I am very new to vbscripting so please be patient with me.
I am trying to create a script that will check the version of an exe file and post the info to a txt file.
I start with a batch file
gwver.bat
Code: Select all
IPCONFIG |FIND "IP" > %temp%\TEMPIP.txt
FOR /F "tokens=2 delims=:" %%a in (%temp%\TEMPIP.txt) do set IP=%%a
del %temp%\TEMPIP.txt
set IP=%IP:~1%
for /F %%* in (c:\ver.vbs) do set ver=%%*
echo %date% , %username% , %computername% , %IP% , GW version = , %ver% , winxp >> c:\install.txt
for the value of %ver% - which would be the file version of the exe file I call on ver.vbs
Code: Select all
strComputer = "."
Dim ver
Set vbShell = CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_Datafile Where Name = 'c:\\novell\\Groupwise\\grpwise.exe'")
For Each objFile in colFiles
ver = objFile.Version
batchFile = c:\gwver.bat
vbShell.run batchFile & ver
Thu 12/08/2011 , rene , WLLB-RENE , 205.189.26.163 , GW version = , , winxp
This is not working. How do I get that variable of ver from the vbs script to the batch file.
Thank you.
Rene
----------------------------
#2 09 Dec 2011 02:25
jaffamuffin
I'm going to guess that you might want to change you for to readrene wrote:
Hello. I am very new to vbscripting so please be patient with me.
I am trying to create a script that will check the version of an exe file and post the info to a txt file.
I start with a batch file
gwver.bat
ReneCode: Select all
IPCONFIG |FIND "IP" > %temp%\TEMPIP.txt FOR /F "tokens=2 delims=:" %%a in (%temp%\TEMPIP.txt) do set IP=%%a del %temp%\TEMPIP.txt set IP=%IP:~1% for /F %%* in (c:\ver.vbs) do set ver=%%* echo %date% , %username% , %computername% , %IP% , GW version = , %ver% , winxp >> c:\install.txt
Code: Select all
for /F %%A in ('c:\ver.vbs') do set ver=%%A
original thread: https://ss64.org/oldforum/viewtopic.php?pid=5357