Okay, hopefully this is stupid simple for someone. It's been a long time since I've scripted. I have a batch file to change some registry settings around and I'm having trouble with one.
REG ADD "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg /f
So the problem here is the %USERNAME%. When it writes this into the registry it actually pulls the username into the registry.
Example
C:\Users\TestUser\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg
I want the registry entry to say, I just can't figure out how to get the text to just pass as this below. I've tried surrounding it all in quotes, but that didn't help.
C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg
Passing a Variable not as a Variable
Moderator: DosItHelp
Re: Passing a Variable not as a Variable
try using this:
"C:\Users\%%USERNAME%%\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg"
"C:\Users\%%USERNAME%%\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg"
-
- Posts: 2
- Joined: 17 Feb 2012 11:37
Re: Passing a Variable not as a Variable
F*** YEAH!!!! that's what it was!!!!! thank you, and now that I see that I kinda remember that now. God it's been tooooo long. Awesome!
Re: Passing a Variable not as a Variable
One additional note ...
... should be REG_EXPAND_SZ in this case.
Regards
aGerman
zero_snowman wrote:/t REG_SZ
... should be REG_EXPAND_SZ in this case.
Regards
aGerman