Link to home
Start Free TrialLog in
Avatar of shyam pothini
shyam pothini

asked on

creating a batchfile

hello all

I am trying to create a batch file to add registry key.
its should run on both 32bit and 64 bit
there are 2 different registry keys for 32bit and 64bit.
so if it is 32-bit, it adds the 32-bit registry key and vice versa

Any ideas?

Thanks in advance
Avatar of Bill Prew
Bill Prew

Give this a try.

for /f "skip=2 tokens=2-5 delims=," %%A in ('wmic os get osarchitecture^,version /format:csv') do set arch=%%A
if "%arch%" EQU "64-bit" (
    rem do 64 bit logic here
) else (
    rem do 32 bit logic here
)

Open in new window


»bp
Avatar of shyam pothini

ASKER

Thanks,

I am confused.
I want to add commnd here
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
so how can I do that
Based on your question I thought you knew how to add to the registry from batch, and were just looking for help differentiating between 32 and 64 bits.

If you want the exact registry commands, then I would need to know the key and value you want to add for both 32 and 64 bit.


»bp
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks

it didn't work
batch file ran but it didn't add reg key
yes I know how to add the reg keys in batch file
You ran it with elevated privileges, yes?

What errors or output did you get?

What was your final BAT script?


»bp
it worked thanks