Tuesday, December 2, 2008

[THIN] Re: Using %username% in registry files

Why not just use a simple script like this??? No need to overcomplicate the requirement, and the way I’ve done it does not hardcode the path to the dictionary folder in the user’s profile.

 

@echo off

SetLocal

Set KEY=HKCU\Software\Telelogic

REG ADD "%KEY%" /V "DICTIONARY" /D "%UserProfile%\dictionary"

EndLocal

 

Cheers,

Jeremy.

 

From: thin-bounce@freelists.org [mailto:thin-bounce@freelists.org] On Behalf Of Minero, Hector B CIV NSWCDD, K55
Sent: Tuesday, December 02, 2008 11:29 PM
To: thin@freelists.org
Subject: [THIN] Re: Using %username% in registry files

 

Thanks to all that replied.

This worked well.

I didn't try the Expandable String value.

The %%username%% did not work.

 

 

_______________________________
Hector Minero
NSWCDD K55

-----Original Message-----
From: thin-bounce@freelists.org [mailto:thin-bounce@freelists.org] On Behalf Of Kevin Stewart
Sent: Tuesday, December 02, 2008 8:41 AM
To: thin@freelists.org
Subject: [THIN] Re: Using %username% in registry files

Worst case you can generate the reg file from script:

@echo off
echo Windows Registry Editor Version 5.00 > tmp.reg
echo [HKEY_CURRENT_USER\Software\Telelogic] >> tmp.reg
echo "DICTIONARY"="C:\\Documents and Settings\\%username%\\dictionary" >> tmp.reg
regedit /s tmp.reg
echo y |del tmp.reg

Kevin

On Tue, Dec 2, 2008 at 8:17 AM, StGeorge <wcsconnect@gmail.com> wrote:

Hector,

Try %%username%%

Regards

Rob

 

On Tue, Dec 2, 2008 at 10:08 PM, Minero, Hector B CIV NSWCDD, K55 <hector.minero@navy.mil> wrote:

 

Hi all, is there a way to use the %username% variable in reg files? Something like:

[HKEY_CURRENT_USER\Software\Telelogic]
"DICTIONARY"="C:\Documents and Settings\\%username%\dictionary"

After running it, the "%username%" is entered in their registry.  What's the correct syntax?

Thanks,

_______________________________
Hector Minero
NSWCDD K55

 




--
Kevin G. Stewart


Confidentiality and Privilege Notice
This document is intended solely for the named addressee.  The information contained in the pages is confidential and contains legally privileged information. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone, and you should destroy this message and kindly notify the sender by reply email. Confidentiality and legal privilege are not waived or lost by reason of mistaken delivery to you.

No comments: