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. windows ping RPi 2B

    /************************************************************************* * windows ping RPi 2B * 声 ...

  2. css的框架——common.css

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

  3. NopCommerce架构分析之五------Model绑定Action参数

    asp.net MVC中Action参数不只是一些基本类型,也支持实体参数.那么从客户端传来的数据如何映射或转换成实体对象呢?就是通过实体绑定类ModelBinder.此系列类在请求转化为后台Cont ...

  4. unix network programming(3rd)Vol.1 [第2~5章]《读书笔记系列》

    13~22章 重要 第2章 传输层: TCP/ UDP / STCP (Stream Control Transmission Protocol) TCP 可靠,有重传机制,SYN队列号 UDP 不可 ...

  5. Parallel stepped for loops in .NET C# z

    ; i < ; i += ) public IEnumerable<int> SteppedIntegerList(int startIndex, int endEndex, int ...

  6. keybd_event跟SendMessage,PostMessage模拟键盘消息的区别 z

    首先你会发现keybd_event函数中是没有窗口句柄作为参数的,好奇的你一定会觉得很奇怪,那是因为,keybd_event是全局模拟按键的,只对前台窗口(即当前的活动窗口)才可以,但是如果模拟的按键 ...

  7. A Fast Priority Queue Implementation of the Dijkstra Shortest Path Algorithm

    http://www.codeproject.com/Articles/24816/A-Fast-Priority-Queue-Implementation-of-the-Dijkst http:// ...

  8. SQL Server 触发器:表的特定字段更新时,触发Update触发器

    create trigger TR_MasterTable_Updateon MasterTableafter updateas if update ([Type])--当Type字段被更新时,才会触 ...

  9. 【JMeter】JMeter在linux下运行

    之前在用JMeter做性能测试时基本都用自己的笔记本电脑. 考虑到网络传输和占用系统资源情况时进行了以下分析: 1 在笔记本上,开始-cmd "ping 服务器",得到传输时间.在 ...

  10. js跟着鼠标移动的文字

    废话不多说,直接上代码,有注释: <head> <title></title> <style type="text/css"> sp ...