1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

UNSET a Variable

Discussion in 'Support' started by CWBillow, Aug 11, 2012.

  1. CWBillow

    Joined:
    Jul 12, 2008
    Messages:
    194
    Likes Received:
    0
    I have a system variable [LFMBROWSER] that I ran a command on

    unset /s /u LFMBROWSER

    But it still is showing via the "set" command, and in MyComputer / Advanced System Settings / Environment Variables

    What am I doing wrong?

    Regards,
    Chuck Billow
     
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,075
    Likes Received:
    30
    1. It doesn't make much sense to use both /s and /u
    2. No surprise it's still in TCC's environment; you didn't unset it there (that's what /e is for)
    3. Do you close/reopen the system variables dialog? Here (Win7), it disappears.

    Brief tutorial: Every process inherits the environment of its parent process. From then on that environment belongs solely to that process. In the case of TCC you manipulate it with [un]set and whatever it is at the moment is passed to (TCC) child processes. When you use /s or /u you're manipulating environments stored in the registry (/u ... the HKEY_CURRENT_USER one ... used at login, /s ... the HKEY_LOCAL_MACHINE one ... used at startup) and broadcasting a message saying that you did that. As I said before, Explorer updates its own environment as a result of receiving that message (few other apps do). If you want to **also** affect the current TCC environment when you use /s or /u, then also use /e.
     
  3. CWBillow

    Joined:
    Jul 12, 2008
    Messages:
    194
    Likes Received:
    0
    Vince, I used both /s and /u in case I was " missing something."

    "All" I am trying to do is: set a var to represent the given browser, so that any btm file can call LFMBROWSER and get the browser I want at that "moment." That way any number of shortcuts that rely on a browser will use the one I want.

    So...

    If I set up a shortcut with

    %LFMBROWSER% http://www.last.fm/listen/artist/Chicago/similarartists

    I can control which browser attaches to that link.

    THEN I fond that I had to account for vars being already set [as you undoubtedly are aware.

    The shortcut I have now is [for example]

    %LFMBROWSER% http://www.last.fm/listen/globaltags/60s

    So then I thought [silly me] that I should use a batch file. Within that bat [btm] file, I could set / verify the browser that would be called -- not always the default browser. Then, because I had set several shortcuts to call the browser via %LFMBROWSER%, I came to the problem of setting and unsetting a TCC / TCMD variable.

    This of course is assuming that, by associating btm files to TCC [for example], I would be in a TCC environment when I executed a shortcut.

    I THOUGHT I understood what you were telling me, but obviously I am having a senior moment.

    Chuck
     
  4. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,075
    Likes Received:
    30
    TCC /TCMD has nothing to do with your shortcuts that have the %LFMBROWSER% target. That's Explorer's business. If you want to change Explorer's idea of what %LFMBROWSER% means, TCC is one way to do that. Just "SET /U LFMBROWSER=some-browser" ... want to change the browser ... "SET /U LFMBROWSER=some_other_browser". That changes some info in a registry key and announces (to any app that's interested) that such a change was made. Explorer gets the announcement and changes its own (i.e., Explorer's) environment so it (Explorer) has a new notion of what %LFMBROWSER% means and does the right thing when you 2click a shortcut.
     
  5. CWBillow

    Joined:
    Jul 12, 2008
    Messages:
    194
    Likes Received:
    0
    Vince, so then I could have a btm file to set the variable that reads

    "SET /U LFMBROWSER=some-browser"

    and then the shortcut to any specific link would just read "LFMBROWSER http://somewhere.com"?

    It would "stick" as long as I was logged in? I wouldn't need to worry about system assignments? I wouldn't have to unset any previous assignment?

    Then I could either assign the variable and then use "LFMBROWSER http://somsite.com" as the site shortcut, and control the browser with the one-line SET /U assignment?

    I wouldn't have to differentiate between system and personal variables or anything else?

    Chuck
     
  6. CWBillow

    Joined:
    Jul 12, 2008
    Messages:
    194
    Likes Received:
    0
    Vince;

    So I changed the shortcut that sets the browser default to

    SET /U LFMBROWSER="C:\WinApps\Comm\Internet\Browsers\Firefox\firefox.exe"

    but it remained a Chrome call for

    %LFMBROWSER% http://www.last.fm/listen/artist/Katie+Melua/similarartists

    I tried it on several browser assignments, but the same thing happened.

    It was a separate shortcut to set the browser and to call the net link.

    So what the heck is wrong here?

    Chuck
     
  7. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,075
    Likes Received:
    30
    Yes. And it would stick forever. That's the point of the /u and /s environments; they're saved and reinstated upon login or restart (respectively). Change it and the new one will be remembered until you change it again. All users get the variables assigned with /S; **you** get (at login) the ones assigned with /U. I wouldn't even bother with the /S environment (you wouldn't even see your shortcuts if you logged in as another user). If you want to see where these are saved, use REGEDIT.EXE and navigate to HKEY_CURRENT_USER\Environment and to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment. When you login, the two environments are merged and become the environment of the shell (Explorer). All processes are free to mess with their own environment (as with SET var=value); these changes are propagated to child processes but no up to parent processes.
     
  8. CWBillow

    Joined:
    Jul 12, 2008
    Messages:
    194
    Likes Received:
    0
    I got it -- I THINK. I was having problems, but I found out that the quotation marks were the problem.

    This SHOULD work.

    Thanks Vince.

    Regards,
    Chuck
     

Share This Page