On Error Resume Next
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
'Create commonly used objects
Set WshShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshNetwork = WScript.CreateObject("WScript.Network")
'get the computer name
strComputer = WshNetwork.ComputerName
'Write Computer Name to file
Set objTextFile = objFSO.OpenTextFile _
("C:\computer.txt", ForWriting, True)
objTextFile.WriteLine strComputer
objTextFile.Close
Monday, August 01, 2011
Simple vbscript to write computer name to file
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment