首页 > 其他 > 详细

vbscript调用fso

时间:2014-12-08 22:47:48      阅读:336      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!