用VBS修改网络txt文件

来源:百度知道 编辑:UC知道 时间:2024/05/25 01:48:04
比如一个txt文件的网络路径为 \\server\up$\abc.txt
我想用vbs往这里txt文件里面续写一排文字,一排文字中包含有机器号
Set oshell=WScript.CreateObject("Wscript.NetWork")
name=oshell.ComputerName
这段代码可以获取机器号
比如要往这个txt文件里面写入一排文字“36号机启动成功”,其中36就是机器号,应该怎么写,求高手指点
注:下一台机器启动此VBS,继续往这个txt文件另起一行续写

Set oshell=WScript.CreateObject("Wscript.NetWork")
name=oshell.ComputerName
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("\\server\up$\abc.txt", ForAppending, True)
objTextFile.WriteLine(name)
objTextFile.Close

FSO...