Solved

registry script

Posted on 2004-08-03
13
3,430 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
Windows 7 does not have the best desktop search built in. This is something Windows 7 users have struggled with. You type something in, and your search results don’t always match what you are looking for, or it doesn’t actually work at all. There ar…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

756 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