locked
REG_BINARY with Windows Environment variable its possible? RRS feed

  • Question

  • Hello guys.

    The Microsoft Outlook saves the .OST file location in a REG_BINARY value. The value redirect the Outlook to find the .OST file in C:\users\jhon.contoso\appdata\.......\XYZ.OST (just a example)

    I need to replace C:\users\jhon.contoso\ with %userprofile% environment. The code to do this is:

    25,00,75,00,73,00,65,00,72,00,70,00,72,00,6f,00,66,00,69,00,6c,00,65,00,25,00, (you can check this on any online conversion tool)

    But when I put this code on registry and start the Microsoft Outlook the error says "not possible to find the file on C:\windows\system32\%userprofile%....\XYZ.ost"

    There's some way to put %userprofile% in a REG_BINARY?

    Monday, January 8, 2018 1:32 PM

Answers

  • If the value is a series of bytes that contains a string of some encoding, then the program that reads the value (in this case, Outlook) would have to examine the string and replace the environment variable references.

    If Outlook does not currently do this, then the answer to your question is: No, that's not going to work.

    %-sign environment variable substitution doesn't happen because we think it should or because we want it to.


    -- Bill Stewart [Bill_Stewart]

    • Proposed as answer by Bill_Stewart Wednesday, January 17, 2018 10:16 PM
    • Marked as answer by Bill_Stewart Friday, March 9, 2018 7:44 PM
    • Unmarked as answer by Lacerda Adrecal Thursday, April 19, 2018 1:32 PM
    • Marked as answer by Bill_Stewart Thursday, April 19, 2018 3:24 PM
    Monday, January 8, 2018 5:52 PM

All replies

  • The %name% syntax is used by the cmd.exe shell (and in some places, Windows Explorer) to mean "replace the value of the named environment variable with its content." This does not happen magically and has to be designed into every program that uses it. When you put in in the registry like that, it is inserting the literal string %username% and not expanding the environment variable reference.

    For that to work, it would have to be designed into Outlook (just like it's in cmd.exe and Windows Explorer). In other words, just because you use %name% syntax doesn't mean it works everywhere, as Raymond Chen wrote about a while back.


    -- Bill Stewart [Bill_Stewart]

    Monday, January 8, 2018 4:08 PM
  • The %name% syntax is used by the cmd.exe shell (and in some places, Windows Explorer) to mean "replace the value of the named environment variable with its content." This does not happen magically and has to be designed into every program that uses it. When you put in in the registry like that, it is inserting the literal string %username% and not expanding the environment variable reference.

    For that to work, it would have to be designed into Outlook (just like it's in cmd.exe and Windows Explorer). In other words, just because you use %name% syntax doesn't mean it works everywhere, as Raymond Chen wrote about a while back.


    -- Bill Stewart [Bill_Stewart]


    So.... no way to setup a env variable to registry on REG_BINARY instead REG_SZ or REG_EXPAND_SZ?
    Monday, January 8, 2018 5:44 PM
  • The only way to control where profiles are created is through Group Policy or the Office installer customization file.

    Post in  Office deployment forum to get assistance with managing and configuring Office products.


    \_(ツ)_/


    • Edited by jrv Monday, January 8, 2018 5:51 PM
    Monday, January 8, 2018 5:50 PM
  • If the value is a series of bytes that contains a string of some encoding, then the program that reads the value (in this case, Outlook) would have to examine the string and replace the environment variable references.

    If Outlook does not currently do this, then the answer to your question is: No, that's not going to work.

    %-sign environment variable substitution doesn't happen because we think it should or because we want it to.


    -- Bill Stewart [Bill_Stewart]

    • Proposed as answer by Bill_Stewart Wednesday, January 17, 2018 10:16 PM
    • Marked as answer by Bill_Stewart Friday, March 9, 2018 7:44 PM
    • Unmarked as answer by Lacerda Adrecal Thursday, April 19, 2018 1:32 PM
    • Marked as answer by Bill_Stewart Thursday, April 19, 2018 3:24 PM
    Monday, January 8, 2018 5:52 PM
  • If the value is a series of bytes that contains a string of some encoding, then the program that reads the value (in this case, Outlook) would have to examine the string and replace the environment variable references.

    If Outlook does not currently do this, then the answer to your question is: No, that's not going to work.

    %-sign environment variable substitution doesn't happen because we think it should or because we want it to.


    -- Bill Stewart [Bill_Stewart]

    the point is that an environment variable is a feature of Microsoft Windows and it is inadmissible that a product like Outlook can not read this type of information.
    "
    %-sign environment variable substitution doesn't happen because we think it should or because we want it to." it could happen if Microsoft works on this.
    Thursday, April 19, 2018 1:35 PM
  • it is inadmissible that a product like Outlook can not read this type of information.

    Complaining about it isn't going to change it; particularly not here, where we are not Microsoft employees and have no power to change it. Of course Microsoft could implement this, but as with any engineering effort, there are trade-offs. It is unlikely to happen unless there is a very large benefit in regard to the engineering effort required to implement it.


    -- Bill Stewart [Bill_Stewart]

    Thursday, April 19, 2018 3:23 PM