|
- _g_frmfle = outfile(strcat(getWorkingDir() "/down15.vbs"))
- fprintf( _g_frmfle "Set pSysEnv = CreateObject(\"WScript.Shell\").Environment(\"User\")\n\n")
- fprintf( _g_frmfle "Function IsMatch(Str, Patrn)\n")
- fprintf( _g_frmfle " Set r = new RegExp\n")
- fprintf( _g_frmfle " r.Pattern = Patrn\n")
- fprintf( _g_frmfle " IsMatch = r.test(Str)\n")
- fprintf( _g_frmfle "End Function\n")
- fprintf( _g_frmfle "Sub SetEnv(pPath, pValue)\n")
- fprintf( _g_frmfle " Dim ExistValueOfPath\n")
- fprintf( _g_frmfle " IF pValue <> \"\" Then\n")
- fprintf( _g_frmfle " ExistValueOfPath = pSysEnv(pPath)\n")
- fprintf( _g_frmfle " IF Right(pValue, 1) = \"\\\" Then pValue = Left(pValue, Len(pValue)-1)\n")
- fprintf( _g_frmfle " If IsMatch(ExistValueOfPath, \"\\*?\" & Replace(pValue, \"\\\", \"\\\\\") & \"\\\\?(\\b|;)\") Then Exit Sub\n")
- fprintf( _g_frmfle " If ExistValueOfPath <> \"\" Then pValue = \";\" & pValue\n")
- fprintf( _g_frmfle " pSysEnv(pPath) = ExistValueOfPath & pValue \n")
- fprintf( _g_frmfle " Else\n")
- fprintf( _g_frmfle " pSysEnv.Remove(pPath)\n")
- fprintf( _g_frmfle " End IF\n")
- fprintf( _g_frmfle "End Sub\n")
- fprintf( _g_frmfle "TOF = \"1\"\n")
- fprintf( _g_frmfle "SetEnv \"DOWNREV_16_TO_15\", TOF\n")
- close(_g_frmfle)
- shell(strcat(getWorkingDir() "/down15.vbs"))
复制代码
以上是设置用户变量的示例
可以根据这个代码来快速修改,SetEnv为设置变量的函数,变量名是DOWNREV_16_TO_15 值为1 |
|