Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VBS script question ( simple one )

VBS script question ( simple one )

Scheduled Pinned Locked Moved Visual Basic
questionc++windows-adminlinuxtools
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stephane Routelous
    wrote on last edited by
    #1

    Hi, First, it is the first time I'm doing something in VB. I have a problem : I want to make a vb script to create a registry key in our buildAll.bat file, which is builing all our VC++ dlls/exes. Here is my script : Dim MyPath MyPath = CurDir Dim intDoIt intDoIt = MsgBox(MyPath) Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.RegWrite "HKLM\SOFTWARE\Company\Product\InstallDir", MyPath As you can see, I'm trying to set the install path from the current path. The problem is that the script doesn't works : the MyPath variable is empty. Any idea ? thanks in advance.


    Stephane

    www.exotk.org

    S Richard DeemingR V 3 Replies Last reply
    0
    • S Stephane Routelous

      Hi, First, it is the first time I'm doing something in VB. I have a problem : I want to make a vb script to create a registry key in our buildAll.bat file, which is builing all our VC++ dlls/exes. Here is my script : Dim MyPath MyPath = CurDir Dim intDoIt intDoIt = MsgBox(MyPath) Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.RegWrite "HKLM\SOFTWARE\Company\Product\InstallDir", MyPath As you can see, I'm trying to set the install path from the current path. The problem is that the script doesn't works : the MyPath variable is empty. Any idea ? thanks in advance.


      Stephane

      www.exotk.org

      S Offline
      S Offline
      Stephane Routelous
      wrote on last edited by
      #2

      forget it ! I created a win32 exe doing it.


      Stephane

      www.exotk.org

      1 Reply Last reply
      0
      • S Stephane Routelous

        Hi, First, it is the first time I'm doing something in VB. I have a problem : I want to make a vb script to create a registry key in our buildAll.bat file, which is builing all our VC++ dlls/exes. Here is my script : Dim MyPath MyPath = CurDir Dim intDoIt intDoIt = MsgBox(MyPath) Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.RegWrite "HKLM\SOFTWARE\Company\Product\InstallDir", MyPath As you can see, I'm trying to set the install path from the current path. The problem is that the script doesn't works : the MyPath variable is empty. Any idea ? thanks in advance.


        Stephane

        www.exotk.org

        Richard DeemingR Online
        Richard DeemingR Online
        Richard Deeming
        wrote on last edited by
        #3

        If you have the latest scripting engine (5.6), you can use the CurrentDirectory property of the Shell object:

        Dim WshShell : Set WshShell = WScript.CreateObject("WScript.Shell")
        Dim MyPath : MyPath = WshShell.CurrentDirectory
        Dim intDoIt : intDoIt = MsgBox(MyPath)
        WshShell.RegWrite "HKLM\SOFTWARE\Company\Product\InstallDir", MyPath

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        1 Reply Last reply
        0
        • S Stephane Routelous

          Hi, First, it is the first time I'm doing something in VB. I have a problem : I want to make a vb script to create a registry key in our buildAll.bat file, which is builing all our VC++ dlls/exes. Here is my script : Dim MyPath MyPath = CurDir Dim intDoIt intDoIt = MsgBox(MyPath) Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.RegWrite "HKLM\SOFTWARE\Company\Product\InstallDir", MyPath As you can see, I'm trying to set the install path from the current path. The problem is that the script doesn't works : the MyPath variable is empty. Any idea ? thanks in advance.


          Stephane

          www.exotk.org

          V Offline
          V Offline
          Vi2
          wrote on last edited by
          #4

          What is about MyPath = WScript.Path? Or using WScript.ScriptFullName and WScript.ScriptName? With best wishes, Vita

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups