码迷,mamicode.com
首页 > 其他好文 > 详细

vbscript调用fso

时间:2014-12-08 22:49:54      阅读:311      评论:0      收藏:0      [点我收藏+]

标签:io   ar   os   使用   sp   on   文件   数据   bs   

function getVersion(strPath)
Dim fver, fso
Set fso = CreateObject("Scripting.FileSystemObject")
fver = fso.GetFileVersion(strPath)
getVersion=fver
end function

sub saveResult(strOutPath,str)
Dim fver, fso
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set fileObj = fso.opentextfile(strOutPath+"\\version.xml",2,true) ‘使用FSO创建文件写入对象
fileObj.Write str ‘向文件写入数据,覆盖形式写入
fileObj.close ‘推送内容写入并关闭写入通道
end sub

‘Create an arguments object
Dim oArgs
Set oArgs = WScript.Arguments

‘Get the named arguments
Dim oNamed
Set oNamed = oArgs.Named

‘Get the computer name argument
Dim strPath
strPath = oNamed("strPath")

Dim strOutPath
strOutPath = oNamed("outPath")

dim tmp
tmp=getVersion(strPath+"\\install.exe")
tmp=tmp+"test"
msgbox tmp

saveResult strOutPath, tmp
msgbox strOutPath

 

 

dos命令行中:

   CScript "getFileVer.vbs" /strPath:C:\ /outPath:c:\

 

vbscript调用fso

标签:io   ar   os   使用   sp   on   文件   数据   bs   

原文地址:http://www.cnblogs.com/xjyggd/p/4152115.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!