vbscript statement mismatch string failing [duplicate]

帅比萌擦擦* 提交于 2019-12-13 10:51:52

问题


I am running the script listed in the link below.

PwExpChk.vbs can I add a company logo?

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

It is failing at:

 strCMD =  "\\domain\netlogon\PwExpChk\PWReminder.hta" -13

I ran the command using the mshta.exe manually and it ran successfully. If I remove the -13 it runs successfully.

The error that generates is "Type mismatch: '[string "\\domain\netlogon\"]' ... the -13 needs to be there, Any help would be great

EDIT Add code from below

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

回答1:


This will take care of your syntax error

Change the offending line to

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 was thinking you wanted to subtract 13 from a string



来源:https://stackoverflow.com/questions/38386289/vbscript-statement-mismatch-string-failing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!