VBS script question ( simple one )
-
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
-
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
-
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
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 -
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