• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3443
  • Last Modified:

registry script

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
merowinger
Asked:
merowinger
  • 4
  • 2
  • 2
  • +4
1 Solution
 
Luniz2k1Commented:
Try the following:

REG.EXE UPDATE "HKCR\JPEGFILE\SHELL\OPEN\COMMAND\(Standart)"="C:\Programme\Gemeinsame Dateien\Microsoft Shared\PhotoEd\PhotoEd.exe"
0
 
merowingerAuthor Commented:
no sorry there appears a message:
update cannot import. error opening the file. possible causes is a disk error

mero
0
 
Luniz2k1Commented:
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
2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

 
merowingerAuthor Commented:
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
 
Debsyl99Commented:
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
 
StGoYCommented:
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
 
Debsyl99Commented:
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
 
merowingerAuthor Commented:
hi,
i'm not searching for the kind to execute else for the code

mero
0
 
StGoYCommented:
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
 
merowingerAuthor Commented:
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
 
dis1931Commented:
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
 
spinewrCommented:
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
 
asafganotCommented:
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

  • 4
  • 2
  • 2
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now