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. 架构版本与 NuGet 的版本不兼容 解决方案

    VS的NuGet管理在大大提高了开发效率,一直都在使用但今天在遇到了一个问题,引用一个所需要的NuGet包VS缺提示如下错误

  2. 百度分享不支持https的解决方案

    站点自从开启 https 之后 ,百度分享就不能用了!但是又寻找不到类似百度分享的替代品.. 怎么办呢?要如何解决 百度分享不支持https的问题呢, 跟着博主动动手,让你百度分享仍然能在https下 ...

  3. What is Cross Linux From Scratch?

    /**************************************************************************** * What is Cross Linux ...

  4. 【转】基于Android Fragment功能的例子

    原文网址:http://blog.csdn.net/eyu8874521/article/details/8252216 通过最近空闲时候对Fragment的学习,尝试着写了一个小Demo,将在开发的 ...

  5. DOM的定义及DOM相关

    DOM : Document Object Model 文档对象模型文档:html页面文档对象:页面中元素文档对象模型:定义 为了能够让程序(js)去操作页面中的元素 DOM会把文档看作是一棵树,同时 ...

  6. Android调试工具及方法

    转自:http://www.cnblogs.com/feisky/archive/2010/01/01/1637566.html Logcat Dump一份系统消息的日志.这些消息包括模拟器抛出错误时 ...

  7. HDU 5285 wyh2000 and pupil

    题意:有一群人,已知某两人之间互相不认识,要把这群人分成两部分,每部分至少一人,且在每部分内没有人互不认识. 解法:图染色.某场bestcoder第二题……看完题觉得是个二分图……完全不会二分图什么的 ...

  8. HDU 4081 Qin Shi Huang's National Road System 最小生成树

    分析:http://www.cnblogs.com/wally/archive/2013/02/04/2892194.html 这个题就是多一个限制,就是求包含每条边的最小生成树,这个求出原始最小生成 ...

  9. HDU 1560 DNA sequence DFS

    题意:找到一个最短的串,使得所有给出的串是它的子序列,输出最短的串的长度,然后发现这个串最长是40 分析:从所给串的最长长度开始枚举,然后对于每个长度,暴力深搜,枚举当前位是哪一个字母,注意剪枝 注: ...

  10. HDU 1043 Eight BFS

    题意:就是恢复成1,2,3,4,5,6,7,8,0; 分析:暴力BFS预处理,所有路径,用康拓展开判重,O(1)打印 93ms 还是很快的 #include <iostream> #inc ...