Page 1 of 1

Reload environment variables

Posted: 04 Apr 2019 08:42
by rclkrtrzckr
Hi all

We have a pretty weird setup here in our company, with quite a few windows environment variables involved. I faced a problem yesterday when I had to create windows shortcuts (.lnk) using variables I set on the command line with setx. The shortcuts were only working when I restarted XYplorer - or used windows explorer.

To reproduce my struggle, you can create a variable and a shortcut and see how it works:
  • Code: Select all

    SETX XYPLOREREXE "<path to your exe>"
  • Create a shortcut that opens anything
  • Edit the shortcut, replace the command by

    Code: Select all

    %XYPLOREREXE%
It would be great to have a command to reload all environment variables. Maybe there is one, I didn't find anything.

Cheers

André

Re: Reload environment variables

Posted: 04 Apr 2019 08:50
by jupe
If you did a forum search prior to your post you might have found this topic, where the issue was discussed previously:

viewtopic.php?f=2&t=18439#p156284

Re: Reload environment variables

Posted: 04 Apr 2019 20:56
by rclkrtrzckr
I did, but not properly apparently.

That's sad news. I actually thought this would be an easy thing to do. My favourite keyboard launcher Keypirinha can do this, on demand of course.

http://keypirinha.com/index.html or http://keypirinha.com/packages/env.html

Cheers

André

Re: Reload environment variables

Posted: 05 Apr 2019 02:55
by jupe
Well if the main issue is lnk files, in theory as a workaround you should be able to write a script to read the enviro variables from the registry, read the shortcut target, and manually resolve (ie. replacelist) the variables and run/goto the target via PFA which should be seamless from your point of view, once setup.