/build/static/layout/Breadcrumb_cap_w.png

scripting output

i need to output this to file please assist

many thanks


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_Environment")

For Each objItem in colItems
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "System Variable: " & objItem.SystemVariable
Wscript.Echo "User Name: " & objItem.UserName
Wscript.Echo "Variable Value: " & objItem.VariableValue
Next

0 Comments   [ + ] Show comments

Answers (3)

Posted by: spartacus 17 years ago
Black Belt
0
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

Const OutputFile = "C:\Temp\output.txt"

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set txt = oFSO.OpenTextFile(OutputFile, ForWriting, True)

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_Environment")

For Each objItem in colItems
txt.Writeline "Description: " & objItem.Description
txt.Writeline "Name: " & objItem.Name
txt.Writeline "System Variable: " & objItem.SystemVariable
txt.Writeline "User Name: " & objItem.UserName
txt.Writeline "Variable Value: " & objItem.VariableValue
Next

txt.Close
Posted by: rudi 17 years ago
Yellow Belt
0
hey Spartucus need your assistance again, i need to output the contents of C:\Lotus\Notes\data directory and only need the nsf,ndk and id files

please assist a script you can do would be useful
Posted by: spartacus 17 years ago
Black Belt
0
This should hopefully get you started :

Const FolderToSearch = "C:\Lotus\Notes\data"
Const OutputFile = "C:\Temp\results.txt"

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

Dim oFSO
Dim oFolder,oFiles
Dim text,ext

'Instantiate the FileSystem Object
set oFSO = CreateObject("Scripting.FileSystemObject")

' Check if folder to be searched exists at all and, if not exit gracefully

if oFSO.FolderExists(FolderToSearch) then

' Search Folder was found, so open the report file
Set txt = oFSO.OpenTextFile(OutputFile, ForWriting, True)

set oFolder = OFSO.GetFolder(FolderToSearch)

' Get collection of all the files in the folder to be searched
set oFiles = ofolder.Files

for each file in oFiles
' Get hold of the file extension and, if one of the ones we are looking for, log the filename to the report file
ext = oFSO.GetExtensionName(file.name)
ext = ucase(ext)
if ext = "NSF" OR ext = "NDK" OR ext = "ID" then
txt.writeline file.name
end if
next
txt.close
end if

set oFSO = Nothing


Regards,

Spartacus
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ