Log in

View Full Version : Environment variables [.bat]


wargsm
2008-10-30, 20:06
Looking for some help with this.

So this is what I've set up at home.
Control Panel > System > Advanced > Environment Variables > Edit "Path"

Added the location "C:\documents and settings\username\My Documents\shortcuts"

In that folder I added shortcuts to my most frequently opened folders, programs and menus. Gave them short names.

So now when I press win + R, and type "pic", "My pictures" opens up. When I type "tv", my downloaded tv eps folder opens. You get the idea.

This speeds things up a great deal, and I want to use it at uni.

I can change the environment variable in the usual way, however it resets to default when I log off. Seeing as the whole point of doing this is efficiency, I want to set a batch script that changes the environment variable. That way I just have to run it when I login.

So far I have tried a few things, but none of them worked.

Tried:

win+r
cmd
set path="big;list;of;existing;paths;plus;my;new;one;
set p


This appears to work, however it does not. It adds the variable to "System variables", but does not add it to the "User variables". That doesn't matter at home, but it does at uni. So I still have to add it manually via the advanced tab in System.

Now I can't seen to find a command that will allow me to add a value to the "User variables", only system.

So I tried:

win + r
regedit
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Sessio n Manager\Environment\]


In there I found the value "Path", voila! thats just what I need to edit. One problem....I don't have the fucking permissions required to edit the registry...


So erm, any help would be appreciated. And I know, the amount of time spent trying to do this far dwarfs the amount of time I will ever save. But I want to figure it out...

jwchips
2008-10-31, 16:45
Right, so you don't have write permissions to the registry. You're probably not going to get them, and I have no advice to help you get said permissions.

However, instead of changing the run path, couldn't you just add the folder to the context menu? I can't fully recall how to do this, but I know it's extremely simple. I think the Context folder is in Local Settings or Application Data in C;/Documents & Settings/[your.user.name]/

This would add your folder and contents in the default context menu (right click). A batch file to make this would be simpler, and you should have all the permissions you need.

Or I could be wrong. I've used Linux for too long now....

wargsm
2008-11-03, 11:34
Thanks for the help, but I can't edit the context menu either. That would be a decent trade-off though. I need registry edit permissions again for that to take place every time I log in.

O RLY
2008-11-03, 14:52
If you have access to the task manager you could use the old school trick of elevating your access to system. I can't quite remember how (it's an XP trick). You just kill explorer.exe and set a time to launch it in the command prompt.