Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to figure the INF equiv of %APPDATALOCAL% #1

Closed
shanselman opened this issue Feb 3, 2020 · 4 comments
Closed

Need to figure the INF equiv of %APPDATALOCAL% #1

shanselman opened this issue Feb 3, 2020 · 4 comments

Comments

@shanselman
Copy link
Owner

I need to figure the INF equiv of %APPDATALOCAL% because this

HKCR,Directory\Shell\WindowsTerminalHere\command,,,""c:\users\scott\appdata\local\Microsoft\WindowsApps\wt.exe -d " ""%1"""

needs to be something like this

HKCR,Directory\Shell\WindowsTerminalHere\command,,,""PATHTOAPPDATALOCAL\Microsoft\WindowsApps\wt.exe -d " ""%1"""
and so far neither %APPDATALOCAL% nor $APPDATALOCAL$ work

@Novakov
Copy link

Novakov commented Feb 3, 2020

To expand environment variables value must have type REG_EXPAND_SZ. In INF files values are of REG_SZ type by default. To use REG_EXPAND_SZ it is necessary to add 0x00020000 to flags.

Snippet below adds REG_EXPAND_SZ value:

[version]
signature="$CHICAGO$"

[DefaultInstall]
AddReg    = ABC.Reg

[ABC.Reg]
HKCU,test,DisplayName,0x00020000,"%ENV_VARIABLE%" 

Source: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/inf-addreg-directive

@japj
Copy link

japj commented Feb 3, 2020

Not sure what kind of inf file this is, but https://docs.microsoft.com/en-us/windows-hardware/drivers/install/general-syntax-rules-for-inf-files implies that escaping % with % might do the trick?

@riverar
Copy link

riverar commented Feb 3, 2020

Also: %APPDATALOCAL% is not valid. I think you mean %LOCALAPPDATA%.

@shanselman
Copy link
Owner Author

shanselman commented Feb 3, 2020

Yes, thanks! @riverar that's my fat fingers! It's three things

  • double escape %%
  • REG_EXPAND_SX
  • use the correct ENV var ;)

Got it! 248629c#diff-b218f023c92ea87bfefd7277d503b3c9

shanselman pushed a commit that referenced this issue May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants