Hi there,

Can anyone who is good in scripting tell me what I need to write so when runing my script it looks for files near it, something like script_path & your file. I cant manage to do that. Basically what I need is to run reg file from vbscript but cannot manage to do that coz don`t know how. What I can do is to put hard coded path and it workes but that is lame.

1 Comment   [ + ] Show Comment


  • Not sure I understand your question, have you tried using wildcards?
Please log in to comment

Community Chosen Answer


Option Explicit
Dim objShell, objFSO, CurrentDirectory
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
CurrentDirectory = objFSO.GetParentFolderName(WScript.ScriptFullName)

objShell.Run "RegEdit.exe /S " & Chr(34) & CurrentDirectory & "\MyRegistry.reg" & Chr(34)

Set objShell = Nothing
Set objFSO = Nothing

Answered 06/11/2013 by: jagadeish
Red Belt

Please log in to comment



if you click on the little yellow qeustion mark by Policies or Job rules you will see these

Answered 06/10/2013 by: SMal.tmcc
Red Belt

  • what you want to do is is upload the vbs file as a dependency and call it
    like "on success - launch a program"
    and launch c:\windows\system32\cscript.exe with parameters $(KACE_DEPENDENCY_DIR)\MYSCRIPT.VBS
Please log in to comment

Looks like I really mesed up this question, will try different way. I have reg file which need to be runed from vbs because vbs installs application and in the end I want that the same vbs runs reg file which is in the same location where vbscript is, so I don`t know how to write correct path so vbs see that reg file is in the same location. Hope that was more explained.

Answered 06/11/2013 by: lanselots
Fourth Degree Brown Belt

  • In this case you'll need to hard code the path that the script runs from. On a Windows 7 system it would be c:\ProgramData\Dell\KACE\scripts\<scriptid>\ where <scriptid> is the ID of the script you are running.
    • I am trying to run this one 'MBSASetup-x64-EN.msi' as a dependency but can't seem to get the path correct in the Task itself...
      Error creating process: C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\182\MBSASetup-x64-EN.msi /i: (193)
      Error Code: 193

      Any ideas?
  • try using .\file.reg
    .\ means current directory
Please log in to comment

Thanks for the response, but now I have a problem runing it on Windows 7 x64 because the registry entries are populated in 32 bit registry not 64, any idea how to make runing script so it runs the same reg file but in 64, so it puts all information in correct location.

Answered 06/11/2013 by: lanselots
Fourth Degree Brown Belt

Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja