vbscript语句不匹配字符串失败 [英] vbscript statement mismatch string failing
问题描述
我正在运行下面链接中列出的脚本.
I am running the script listed in the link below.
我用以下内容替换了Msgbox:
I have substituted the Msgbox with the following:
if (daysLeft < warningDays) and (daysLeft > -1) then
strCMD = "\\domain\netlogon\PwExpChk\PWReminder.hta" -13
Set wshShell = CreateObject("Wscript.Shell")
RC = WshShell.run(strCMD , 0, False)
End if
它在以下位置失败:
strCMD = "\\domain\netlogon\PwExpChk\PWReminder.hta" -13
我使用mshta.exe手动运行了命令,并成功运行了.如果我删除-13,它将成功运行.
I ran the command using the mshta.exe manually and it ran successfully. If I remove the -13 it runs successfully.
产生的错误是"Type mismatch: '[string "\\domain\netlogon\"]'
... -13必须在那儿,任何帮助都很好
The error that generates is "Type mismatch: '[string "\\domain\netlogon\"]'
... the -13 needs to be there, Any help would be great
编辑从下面添加代码
我尝试了下面的一个,它调用了hta文件...现在hta文件出错了.
I tried the one below and it calls the hta file... now the hta file errors out.
if (daysLeft < warningDays) and (daysLeft > -1) then
strCMD = "\\domain\netlogon\PwExpChk\PWReminder.hta" & " -" & intDaysRemaining
Set wshShell = CreateObject("Wscript.Shell")
RC = WshShell.run(strCMD , 0, False)
End if
推荐答案
这将解决您的语法错误
将违规行更改为
strCMD = "\\domain\netlogon\PwExpChk\PWReminder.hta -13"
编辑-如果需要在其中加引号,请使用双引号
EDIT - if you NEED the quotes in there, then use double quoting
strCMD = """\\domain\netlogon\PwExpChk\PWReminder.hta""" & " -13"
vbscript认为您想从字符串中减去13
vbscript was thinking you wanted to subtract 13 from a string
这篇关于vbscript语句不匹配字符串失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!