Solved

registry script

Posted on 2004-08-03
13
3,425 Views
Last Modified: 2008-02-01
Hi experts,
i want to edit a reg value via batch, but this is a bit strange.
the registry path is: HKCR\JPEGFILE\SHELL\OPEN\COMMAND
this key contains a key named (Standart). And this key shell have the value: C:\Programme\Gemeinsame Dateien\Microsoft Shared\PhotoEd\PhotoEd.exe

i tried following code:
C:\TEMP\SUPPORT\REG.EXE UPDATE "HKCR\JPEGFILE\SHELL\OPEN\COMMAND\(Standart)=C:\Programme\Gemeinsame Dateien\Microsoft Shared\PhotoEd\PhotoEd.exe"
but this doesnt work!!! What could be the problem, or how must be the code???

thx mero
0
Comment
Question by:merowinger
  • 4
  • 2
  • 2
  • +4
13 Comments
 
LVL 5

Expert Comment

by:Luniz2k1
ID: 11703868
Try the following:

REG.EXE UPDATE "HKCR\JPEGFILE\SHELL\OPEN\COMMAND\(Standart)"="C:\Programme\Gemeinsame Dateien\Microsoft Shared\PhotoEd\PhotoEd.exe"
0
 
LVL 31

Author Comment

by:merowinger
ID: 11704000
no sorry there appears a message:
update cannot import. error opening the file. possible causes is a disk error

mero
0
 
LVL 5

Expert Comment

by:Luniz2k1
ID: 11704069
I just created the string HKCR\JPEGFILE\SHELL\OPEN\COMMAND\(Standart) and ran:

REG.EXE UPDATE "HKCR\JPEGFILE\SHELL\OPEN\COMMAND\(Standart)"="C:\Programme\Gemeinsame Dateien\Microsoft Shared\PhotoEd\PhotoEd.exe"

and it works just fine.

C:\>REG.EXE UPDATE "HKCR\JPEGFILE\SHELL\OPEN\COMMAND\(Standart)"="C:\Programme\Gemeinsame Dateien\Microsoft Shared\PhotoEd\PhotoEd.exe"
The operation completed successfully.
0
 
LVL 31

Author Comment

by:merowinger
ID: 11704131
ok, i try it easier!!!
if i delete the "command" key and create it new, it contains a key named (standard). this is a reg_sz. and this key shell have the value C:\Programme\Gemeinsame Dateien\Microsoft Shared\PhotoEd\PhotoEd.exe

but this silly ( ) arrrhhh!!!!
how do this with batch?? this i have!!!

C:\TEMP\SUPPORT\REG.EXE DELETE "HKCR\JPEGFILE\SHELL\OPEN\COMMAND" /FORCE
C:\TEMP\SUPPORT\REG.EXE ADD      "HKCR\JPEGFILE\SHELL\OPEN\COMMAND .........................= C:\...\PhotoEd.exe"
or
C:\TEMP\SUPPORT\REG.EXE ADD      "HKCR\JPEGFILE\SHELL\OPEN\COMMAND\(STANDARD) .........................= C:\...\PhotoEd.exe"
or...

mero
0
 
LVL 20

Expert Comment

by:Debsyl99
ID: 11704553
Hi

Are you trying to deploy this using logon scripts for example? Well just in case you are:

I tried this and it worked when I wanted to change a registry key on all pc's to point to a mapped drive for default workgroups for templates in word. Different scenario but principle should work the same,

Created a folder on the server to which i saved a .reg file containing the key change called yourregchange.reg: (set correct access permissions for authenticated users ie read/read and execute.

ie Windows Registry Editor Version 5.00

valid registry key and values


The login script batch file contained:

net use r: \\yourserver\RegChanges
regedit.exe /s r:\yourregchange.reg    
net use r: /delete

Hope this helps, and if I miss the point, forgive me!

Deb :))



0
 
LVL 3

Expert Comment

by:StGoY
ID: 11705271
Why would you map a network drive for a single reg file?
That's what NETLOGON is for! ;)

\\Youservername\Netlogon

Input this into a file caled Jpeg.reg :

    [HKEY_CLASSES_ROOT\jpegfile\shell\open\command]
    @="C:\Programme\Gemeinsame Dateien\Microsoft Shared\PhotoEd\PhotoEd.exe"

Then, in your batch file, include this line :

    regedit /s %logonserver%\NETLOGON\Jpeg.reg

Basicly the same this as Deb, with some specifications! ;)

Steph
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 20

Expert Comment

by:Debsyl99
ID: 11705647
Why would you map a network drive for a single reg file?

Just my way as I will need to deploy numerous reg fixes from time to time to various pc's and swap the reg files in and of the mapped folder as necessary then use group policy to deploy it rather than netlogon. Saves having to change the login script on all my users and enables me to keep track of what's where.

Deb :))
0
 
LVL 31

Author Comment

by:merowinger
ID: 11706816
hi,
i'm not searching for the kind to execute else for the code

mero
0
 
LVL 3

Expert Comment

by:StGoY
ID: 11707418
I'm sorry, what?

That didn't quite make sense mero... you're not lookinh for a kind to execute else ?!?

Could ou rephrase that? ;)
0
 
LVL 31

Author Comment

by:merowinger
ID: 11712880
HI,

i want these key:  "HKCR\JPEGFILE\SHELL\OPEN\COMMAND\(Standard) <--
give a value, but my pc says that he cannot find the specified key, but it exists.

manuel i can give these key a value without problems, but i want to solve this via batch!!!
help!!!
mero

P.S. Sorry for my english!!!
0
 
LVL 10

Expert Comment

by:dis1931
ID: 11715071
You can create a regfile with notepad.  Just make sure it has a .reg extension.
 
Include Everything Between the dashed lines in the file------------------------------------------------------------------

Windows Registry Editor Version 5.00

[HKCR\JPEGFILE\SHELL\OPEN\COMMAND]
"Standard"="C:\Programme\Gemeinsame Dateien\Microsoft Shared\PhotoEd\PhotoEd.exe"

--------------------------------------------------------------------------------------------------------------------------------

Then once you save it just double click on the file and it should merge it into the registry.  Just make sure the key/string/data name are all correct if not you will get errors such as "cannot find the specified key"  I suggest going to the location manually in the registry and then clicking on the key on the left side of regedit and clicking on copy key name.  This will copy it exactly as it appears in the registry.

Dis
0
 

Expert Comment

by:spinewr
ID: 11716604
Hello,

Everyone above is pretty correct. The best way to achieve your change is to use the export feature within the Registry Editor. You stated that you can make the change manually.  I am assuming that you can type the command in a dos window and it works fine.  I am also assuming that you are running your batch on your local machine to test and make sure it works first:

Better solution: Run Regedit, navigate to the key you wish to change, export it to a .reg file.
This file can be run from anywhere, locally or networked on various Windows platforms.  You can even call this within your batch file.  The only problem you would run into is if you are using variables in your batch file for the values/keys/data being entered into the registry.  If the key contains other information necessary for your needs, when you export you will receive whatever is in the key.

Special Note: Sometimes running batch based changes work great until you start working with locked down systems, where the end user may not be an administrator of the system.

Let me know how it goes!

Chow!
0
 
LVL 1

Accepted Solution

by:
asafganot earned 500 total points
ID: 11739979
You could use a vbs:

1. Create a new text file and paste the following:

set wshshell = createobject("wscript.shell")
      regkey = "HKCR\JPEGFILE\SHELL\OPEN\COMMAND\(Standart)"
                regval = C:\Programme\Gemeinsame Dateien\Microsoft Shared\PhotoEd\PhotoEd.exe
      wshshell.regwrite regkey ,regval
SET WSHSHELL = NOTHING

2. Save the file in a common location.
3. Rename it to name.vbs.
4. update your batch file with the following command:
cscript <network path\name.vbs>
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now