title: Get current directory and run a File in vbscript?
body: <p>I am trying to see if IIS is installed and display a message and a download exe to INstall IIS if IIS isn't installed.However i am having a hard time running a file without specifying the full path in the vb-script.The path will be dynamic and it impossible to specify any other directory than "%cd%  </p>
  
  <p>My code:</p>
  
  <pre><code>If WScript.Arguments.length =0 Then
  Set objShell = CreateObject("Shell.Application")
  
  objShell.ShellExecute "wscript.exe", Chr(34) &amp; _
  WScript.ScriptFullName &amp; Chr(34) &amp; " uac", "", "runas", 1
  Else
  Dim intCounter, strSubkey
  Const HKEY_LOCAL_MACHINE = &amp;H80000002
  strComputer = "."
  
  Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
  &amp; strComputer &amp; "\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 - " &amp; strSubkey
  End If
  End if
  </code></pre>
  
  <p>My problem is running the  no iisinstalled.exe file.Whatever I'm trying the script cannot find the file.</p>