Tôi đang cố gắng để xem nếu IIS được cài đặt và hiển thị một tin nhắn và một exe tải xuống INstall IIS nếu IIS không được cài đặt.Tuy nhiên tôi đang gặp khó khăn khi chạy một tập tin mà không chỉ định đường dẫn đầy đủ trong vb-script. Con đường sẽ năng động và nó không thể chỉ định bất kỳ thư mục khác hơn là "% cd%Nhận thư mục hiện tại và chạy Tệp bằng vbscript?
mã của tôi:
If WScript.Arguments.length =0 Then
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "wscript.exe", Chr(34) & _
WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1
Else
Dim intCounter, strSubkey
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft"
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
intCounter=0
For Each subkey In arrSubKeys
If subkey="InetStp" Then
intCounter=1 or strSubkey=subkey
End If
Next
currentDirectory = left(WScript.ScriptFullName, Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))
if intCounter=0 then
Set WSHShell = CreateObject("Wscript.Shell")
WSHShell.Run ("\currentDirectory\noiisinstalled.exe")
Elseif intCounter=1 then
Wscript.Echo "IIS is Already installed - " & strSubkey
End If
End if
vấn đề của tôi đang chạy không file.Whatever iisinstalled.exe tôi đang cố gắng kịch bản không thể tìm thấy tập tin
chạy như tôi muốn – deception1