• 0

[VB6] Create an environment variable


Question

OK, i was trying to create an environment variable which i will need later on... The SET command doesnt help at all since it can only make session variables (as soon as cmd is restarted, you no longer have the variable)... I went the registry way, all well and good... But the Command Prompt would only 'see' the new variable, after the system was restarted... However, when I go and manually add/remove a variable through System Properties, it gets 'activated' immediately... Also, i started monitoring the registry to keep track of what the System Properties 'do to activate it immediatelly'... I used the exact same registry entries, and still, i had to refresh the shell...

So my question is:

Is there any native/API way in VB6 to create an environment variable for Command Prompt?

Thanks in advance!

/Raptor

Link to comment
https://www.neowin.net/forum/topic/113579-vb6-create-an-environment-variable/
Share on other sites

4 answers to this question

Recommended Posts

  • 0

I have found rather partial solution, that uses one extra ocx (wshom.ocx) Windows Script Host Object Model.

It can be found there:

http://www.planet-source-code.com/vb/scrip...=38905&lngWId=1

http://www.planet-source-code.com is like Google for VB :)

Tested a little bit, set variable appears in Enviromental Variables > System Variables, but i don't know if it works with cmd, because i don't know how to get Env Variables from cmdline :D

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.