VBS设置系统的环境变量
来源:互联网 发布:mac使用搜狗 编辑:程序博客网 时间:2024/05/18 00:15
程序实现的是系统环境变量设置,更改Enviroment为user可设置用户变量。
Dim currentpathcurrentpath=createobject("Scripting.FileSystemObject").GetFolder(".").PathMsgBox currentpathDim ocrpathocrpath=currentpath&"\Tesseract-OCR"SetTheEnv(ocrpath)Function SetTheEnv(ocrpath)Dim pSysEnvSet pSysEnv = CreateObject("WScript.Shell").Environment("System") pSysEnv("TESSDATA_PREFIX")=ocrpath&"\"Dim ExistValueExistValue=pSysEnv("path")Dim target,s,exist,appendvalueexist=Falseappendvalue=ocrpath&";"&ocrpath&"\training"ExistValue=ExistValue&";"&appendvalueExistValue=reduce(ExistValue,False,";")target=split(ExistValue,";")ExistValue=""For Each s In targetIf s<>"" ThenExistValue=ExistValue&s&";"End IfNextpSysEnv("path")=ExistValue'ExistValue=pSysEnv("wdir")'MsgBox("WDIR="&ExistValue)MsgBox "环境设置成功!"End FunctionFunction reduce(srcstr,casesentive,sp)Dim objDict,x,ysrcarr=split(Trim(srcstr),sp)Set objDict=createobject("Scripting.Dictionary")For Each x In srcArrIf Not casesentive Then y=LCase(x)Elsey=xEnd IfIf Not objDict.Exists(y) Then If y<>lcase(driverLetter)&"\" ThenobjDict.Add y,xEnd IfEnd IfNextreduce=Join(objDict.Items,sp)Set objDict=NothingEnd Function
- VBS设置系统的环境变量
- 设置系统环境变量立即生效的VBS脚本
- 设置系统环境变量立即生效的VBS脚本
- VBS 文件设置环境变量
- 利用vbs设置Java环境变量
- VBS设置系统全局变量
- 操作系统系统环境变量的设置
- windows系统环境变量的设置
- 系统环境变量的设置Delphi函数
- 系统环境变量的设置Delphi函数
- Windows系统python环境变量的设置
- 批处理根据不同的系统设置环境变量
- Android系统编译环境变量的设置
- shell设置系统环境变量的问题
- 设置的系统环境变量不成功 MAC
- 【linux系统】 关于环境变量的设置
- 使用批处理文件设置系统的环境变量
- linux系统设置环境变量
- 哈希表的设计与冲突解决
- libzmq.so.3 => not found
- 使用LVPM缩小wubi安装的ubuntu虚拟硬盘
- 使用C++调用NLTK
- Android权限大全
- VBS设置系统的环境变量
- 指令 ssh 及 putty Linux 和 Windows客户端
- iOS学习之iOS程序名称及内容国际化(本地化) .
- js单步调试方法
- Articles from the inner product
- GMT时间格式转换(Mon Feb 13 08:00:00 GMT+08:00 2012)
- 如何利用socket进行HTTP访问
- 计算机视觉资源
- 从 C/C++ 程序调用 Java 代码 .