You can simply fix this error by using valid expression syntax (and not using
#NoEnv):
Code: Select all
path := "C:\Users\" username "\AppData\Roaming\Code\User"
Run, %path%
Like this, you are using the
username Env variable, but you are overwriting AHK's copy of the
Path variable... but if you don't need it, that's ok.
Edit: there is also Env appdata available, see:
msgbox % appdata
But tbh, I am not sure, if I understand what you specifically intend here. Probably you should read this:
https://www.autohotkey.com/docs/Concepts.htm#environment-variables
With
#NoEnv you could do this:
Code: Select all
#NoEnv
EnvGet, username, username
msgbox % username
path := "C:\Users\" username "\AppData\Roaming\Code\User"
Run, %path%