|
-
Feb 10th, 2005, 11:57 PM
#1
Thread Starter
Member
[Resolved]how to change path variable
guys.
i am writing an application that needs to add my application's path to the PATH variable..is there any way to do it in VB???
thnx
nean
Last edited by neanthedral; Feb 11th, 2005 at 02:18 AM.
Reason: resolved
------------------------------------------------------
"i am neither a psycopath nor ur abnormal demi-god;
me - i am just an average software engineer...which is far worse ..so beware.. " .NeaNthedraL
------------------------------------------------------
-
Feb 11th, 2005, 12:02 AM
#2
Re: how to change path variable
What do you mean by 'path variable'? App.Path ?
-
Feb 11th, 2005, 12:06 AM
#3
Re: how to change path variable
why do you have to do that?
modern day computers don't use the path variable like in the DOS days.
We have shortcuts, and can click on a folder to change to it, so it's really not necessary. If every program used the path variable, it would grow too big.
-
Feb 11th, 2005, 12:11 AM
#4
Thread Starter
Member
Re: how to change path variable
no i mean the PATH environment variable in windows..
why do you have to do that?
becaus i need to put my application path in PATH variable so that next time i can execute my application from the command prompt..
------------------------------------------------------
"i am neither a psycopath nor ur abnormal demi-god;
me - i am just an average software engineer...which is far worse ..so beware.. " .NeaNthedraL
------------------------------------------------------
-
Feb 11th, 2005, 12:20 AM
#5
Thread Starter
Member
Re: how to change path variable
guys got any ideas???
------------------------------------------------------
"i am neither a psycopath nor ur abnormal demi-god;
me - i am just an average software engineer...which is far worse ..so beware.. " .NeaNthedraL
------------------------------------------------------
-
Feb 11th, 2005, 12:36 AM
#6
Re: how to change path variable
Checkout this thread:
http://www.vbforums.com/showthread.php?t=61438
It demonstrates a way to set environment variables such as PATH. So (in theory anyway) you should be able to add your app's path to that.
Hope that helps.
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Feb 11th, 2005, 12:42 AM
#7
Re: how to change path variable
system properties -> environmental variables -> path
as you will see, there are only 4 or 5 things there. every other app does it without editing the path. maybe you want to put a batch file, (or a command/cmd file) to start off your program. that way you can run it from the start menu.
enter this in Notepad, and save it with your c:\appname.cmd
VB Code:
cd \myapp
runmyapp.exe
cd\
that way you can type the appname to start from any folder.
Last edited by dglienna; Feb 11th, 2005 at 12:56 AM.
-
Feb 11th, 2005, 12:53 AM
#8
Re: how to change path variable
 Originally Posted by dglienna
that way you can type the appname to start from any folder.
But neanthedral wants to be able to run his app from a command prompt (don't ask me why) and your suggestion will only work from the command line if appname.cmd can be found in the current PATH.
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Feb 11th, 2005, 12:56 AM
#9
Re: how to change path variable
Sorry, I meant to place it at the root level of your hard drive. this is in the path. anywhere in the path would be OK. you can get the path by typing path at the command prompt
-
Feb 11th, 2005, 01:06 AM
#10
Thread Starter
Member
Re: how to change path variable
hey i saw that thread..there they have said that we can do it using registry...
how do we do that???
------------------------------------------------------
"i am neither a psycopath nor ur abnormal demi-god;
me - i am just an average software engineer...which is far worse ..so beware.. " .NeaNthedraL
------------------------------------------------------
-
Feb 11th, 2005, 01:17 AM
#11
Re: how to change path variable
The PATH environment is stored in the registry here:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
So I guess you could modify it that way.
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Feb 11th, 2005, 01:21 AM
#12
Re: how to change path variable
export the hive before you attempt to change it. if you do it wrong, your system will be unusable.
-
Feb 11th, 2005, 01:24 AM
#13
Re: how to change path variable
 Originally Posted by dglienna
export the hive before you attempt to change it. if you do it wrong, your system will be unusable.
Good advice
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Feb 11th, 2005, 02:05 AM
#14
Thread Starter
Member
Re: how to change path variable
export the hive before you attempt to change it. if you do it wrong, your system will be unusable.
now u are confusing me...
hive??export??
how do i do that???
and how do i change the registry ?? should i use regedit or is there some vb method for this??
n y will my system become unstable??
------------------------------------------------------
"i am neither a psycopath nor ur abnormal demi-god;
me - i am just an average software engineer...which is far worse ..so beware.. " .NeaNthedraL
------------------------------------------------------
-
Feb 11th, 2005, 02:10 AM
#15
Re: how to change path variable
you can use regedit. find the hive (where the key is located) and click export to save a copy of it. whether or not you manage to do what you want, you will always have a way to get back your system, although you would have trouble doing it. safemode would be involved, and it would not be pretty if the system wouldn't start.
it you want, you can also use VB to change the registry. this carries more risks, as you may eventually make the path too big, as I implied before.
I still suggest you use a different method. if you are distributing your program, your users may not like it if you change their path, and they may have software on their system that may not allow it to be changed.
but, at least you were warned.
-
Feb 11th, 2005, 02:17 AM
#16
Thread Starter
Member
Re: how to change path variable
it is taking me time to get what u were saying..
but i think i understand u..
thanks
nean
------------------------------------------------------
"i am neither a psycopath nor ur abnormal demi-god;
me - i am just an average software engineer...which is far worse ..so beware.. " .NeaNthedraL
------------------------------------------------------
-
Feb 11th, 2005, 02:29 AM
#17
Re: [Resolved]how to change path variable
I hope that I helped you not harm your system.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|