VBScript

OptionExplicit

Dim ShellObj, sCathiLoc, sIniFile, sLeft, sFind, pos, boolCathiMode, boolUnicodeMode

set ShellObj =CreateObject("WScript.Shell")
sCathiLoc = EES("%CathiDir%") sIniFile = FileToString(sCathiLoc +"\BindingOutForBug193413.xml") 'Replace the host name of Microsoft.Test.Ebiz.OpsMan.Scenarios.EquityLoan.EquityLoanOrchestration to none
sFind ="<Host Name=""BizTalkServerApplication"" NTGroupName=""BizTalk Application Users"" Type=""1"" Trusted=""true"" />"
pos =InstrRev(sIniFile, sFind)
sLeft =Left(sIniFile, pos -)
sIniFile =Replace(sIniFile, sFind, "<Host xsi:nil=""true"" />", pos -, )
sIniFile = sLeft + sIniFile Call StringToFile(sIniFile, sCathiLoc +"\BindingInForBug193413.xml") '************************************************************
' Utility function to get a enviroment location
'************************************************************
Function EES(EnvVar)
EES = ShellObj.ExpandEnvironmentStrings(EnvVar)
End Function '************************************************************
' Utility function to read a file into a string
'************************************************************
Function FileToString(sPath)
Dim fso, f
Const ForReading =
Const TristateTrue =- Set fso =CreateObject("Scripting.FileSystemObject")
if fso.FileExists(sPath) =then
ifnot boolCathiMode then
wscript.echo "Input file doesn't exist: '"& sPath &"'"
else
Call objLog.LogFail(CStr("Input file doesn't exist: '"& sPath &"'"))
endif
WScript.Quit()
endif if boolUnicodeMode then
Set f = fso.OpenTextFile(sPath, ForReading, false, TristateTrue)
else
Set f = fso.OpenTextFile(sPath, ForReading)
endif FileToString = f.ReadAll
f.Close Set f =Nothing
Set fso =Nothing
end Function '************************************************************
' Utility function to write a string to a file
'************************************************************
Sub StringToFile(sString, sPath)
Dim fso, f, hHandle Set fso =CreateObject("Scripting.FileSystemObject")
if boolUnicodeMode then
Set f = fso.CreateTextFile(sPath, true, true)
else
Set f = fso.CreateTextFile(sPath, true)
endif f.Write sString
f.Close if Err.number <>then
PrintWMIErrorthenExit Err.Description, Err.Number
else
ifnot boolCathiMode then
wscript.echo "Output file is created: '"& sPath &"'"
else
Call objLog.LogInfo(CStr("Output file is created: '"& sPath &"'"))
endif
endif Set f =Nothing
Set fso =Nothing
end Sub

-----------参考网站------------

http://en.wikipedia.org/wiki/VBScript

Wiki

http://www.w3school.com.cn/vbscript/index.asp

VBScript教程@W3School

http://msdn.microsoft.com/en-us/library/k9z80300(v=VS.85).aspx

Replace Method (VBScript)@MSDN

http://msdn.microsoft.com/en-us/library/hsxyczeb(v=VS.85).aspx

InStrRev Function@MSDN

http://forum.openvpn.eu/viewtopic.php?f=25&t=7266&start=0

Example of ShellObj.ExpandEnvironmentStrings

VBScript的更多相关文章

  1. 第 3 章 VBScript流程控制

    学习导航 if...then...else...end if select case...select end for...next do while ... while wend 3.1 认识流程控 ...

  2. 第 2 章 VBScript基本概念

    学习导航 VBScript 基本知识 变量.常量.数组 算术.逻辑.比较 运算符 2.1 VBScript是什么 VBScript程序语言是Microsoft公司VB(Visual Basic)程序语 ...

  3. VBScript使用CDO.Message发送邮件

    Const Email_From = "from@163.com" Const Password = "password" Const Email_To = & ...

  4. vbscript调用WMI一键式式发布网站

    作为.net开发,在window环境下,不得不熟悉些脚本语言,来减轻些日常开发中所遇到的一些繁杂的事情,比如自动发布网站,自动发布网站等等. WMI windows管理程序接口,可用各种与语言调用,方 ...

  5. ITF Demo代码(用VBScript构建的接口测试框架)

    ITF Demo代码(用VBScript构建的接口测试框架) http://blog.csdn.net/testing_is_believing/article/details/20872629

  6. VBScript [ 译 ]

    VBScript ( Visual Basic Scripting Edition) 使用COM 来和宿主环境交互.从Microsoft Windows 98 开始的所有的微软桌面操作系统的relea ...

  7. ASP测试代码: <% response.write("helloworld,vbscript!") %>

    ASP测试代码: <% response.write("helloworld,vbscript!") %>

  8. 在C#中调用VBScript和JavaScript等脚本的实现

    在C#中调用VBScript.JavaScript等脚本的实现 作者:郑佐 2004-04-26 以前在做工作流(workflow)项目的时候,里面有一项就是在用户制定流程定义时可以编写脚本来控制活动 ...

  9. VBScript 函数

    Date/Time 函数 Conversion 函数 Format 函数 Math 函数 Array 函数 String 函数 其他函数 Date/Time 函数 函数 描述 CDate 把一个有效的 ...

  10. VBSCRIPT事件绑定(隐式)

    很多新版的浏览器都开始不支持VBSCRIPT 所以系统开始不断地有script错误,开始比较多地接触VBSCRIPT vbscript 和javascript 事件绑定的类似方法为 vbscript: ...

随机推荐

  1. UVA 11082 Matrix Decompressing 矩阵解压(最大流,经典)

    题意: 知道矩阵的前i行之和,和前j列之和(任意i和j都可以).求这个矩阵.每个格子中的元素必须在1~20之间.矩阵大小上限20*20. 思路: 这么也想不到用网络流解决,这个模型很不错.假设这个矩阵 ...

  2. css的框架——common.css

    @charset "utf-8"; /* 字体 */ .n{ font-weight:normal; font-style:normal; } .b{font-weight:bol ...

  3. (转载)内联函数inline和宏定义

    (转载)http://blog.csdn.net/chdhust/article/details/8036233 内联函数inline和宏定义   内联函数的优越性: 一:inline定义的类的内联函 ...

  4. 转换Json格式帮助类

    using System; using System.Collections.Generic; using System.Text; using System.Reflection; using Sy ...

  5. Kettle定时执行(ETL工具)【转】

    1,Kettle跨平台使用.    例如:在AIX下(AIX是IBM商用UNIX操作系统,此处在LINUX/UNIX同样适用),运行Kettle的相关步骤如下:    1)进入到Kettle部署的路径 ...

  6. ln (link)命令

    ln是linux中又一个非常重要命令,它的功能是为某一个文件在另外一个位置建立一个同步的链接.当我们需要在不同的目录,用到相同的文件时,我们不需要在每一个需要的目录下都放一个必须相同的文件,我们只要在 ...

  7. DELPHI 中的Delay函数,利用GetTickCount和Application.ProcessMessages构建

      作者 关劲松           delphi 开发中有些时候需要停留片刻,等待界面输入,或异步操作完成,如果使用sleep函数的话,整个程序都会停顿,界面还会出现冻结的情况.因此需要自行编写一个 ...

  8. Zabbix探索:资产信息的妙用

    前一阵子还在考虑CMDB的问题,因此Zabbix中的Inventory,也就是所谓的资产信息,遭到了我的不少鄙视. 这几天在研究告警通知对应责任人的问题,突然想起Zabbix的资产信息中应该有这么一栏 ...

  9. static,interface and final

    1.static: a)抽象类(abstract class):使用了 abstract 关键字所修饰的 类叫做抽象类.抽象类无法实例化,不能 new 出来一个抽象类的对象(实例). 抽象方法(abs ...

  10. iOS7滑动返回

    [转载请注明出处] iOS 7中在传统的左上角返回键之外,提供了右滑返回上一级界面的手势.支持此手势的是UINavigationController中新增的属性 interactivePopGestu ...