Jump to content

batch script to run reg keys


Recommended Posts

Cool thanks you very much, I totaly get it now Im a bit of a newbie with batch and cmd file. Hey do you know if you can call a cmd file from bat file. I ask cause on my windows disk after it installs and boots up for the first time it runs a setup.bat which install some programs and cleans up the start menu and so on and this is when I want the cmd to run. So can I call it for the batch file or start or run it? now sure with way would be the right way.

Thanks for all your help

Link to comment
Share on other sites


ok I have tested it and it looks like I can call it from a batch script. =)

Can you make sure this code is right for me

@Reg "HKEY_CLASSES_ROOT\Directory\shell\Command Prompt\command" /ve /d
"\"cmd.exe\" /k cd \"%%1\"" /f>Nul

Here is what the .reg key I exported says

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Command Prompt\command]
@="cmd.exe /k cd %1"

Link to comment
Share on other sites

This should do:

@Reg add "HKCR\Directory\shell\Command Prompt\command" /ve /d
"cmd.exe /k cd \"%%1\"" /f>Nul

or as I said before

@Reg add "HKLM\SOFTWARE\Classes\Directory\shell\Command Prompt\command" /ve /d
"cmd.exe /k cd \"%%1\"" /f>Nul

Incidentally .bat is for legacy use and for your purposes is not required, you should rename those .bat files to .cmd.

You can run scripts from another either directly using the Start command or using the Call command.

Link to comment
Share on other sites

Ok im so close to being done I can taste it. The .cmd Im running (which I have uploaded) runs the first 2 reg adds but gets held up on the third (I have uploaded a pic). Can you help me fix what ever is wrong with this last reg add. Cool little note instead of starting or calling the cmd file I drop it in the $OEM$ to be dropped in the start menu start up so it all works right it will run on the first start up and delete it self. =) and I have already tested if I get that last one up and running my disk is done... till V.3

PS If you fix the cmd file it would be really cool if you uploaded it back to me =)

reg.cmd

Edited by JayDogg
Link to comment
Share on other sites

Dam so close but it for some reason doesnt delete it self at the end so when the pc restarts it gets stuck in this loop( I uploaded an error image for you to see)

Thanks so so so much for all your help

Edited by JayDogg
Link to comment
Share on other sites

Change the name of your script, preferably to something which is also not the name, (without extension), of an existing file in %Path%.

Instead of:

Del %0

You could also use this as your last line:

Start/b %Comspec% /c @Del "%~f0"

Link to comment
Share on other sites

Cool thanks you so much my disk is working great =) I just did a test install and it went of with out a hitch. Now there was one last thing I wanted to do but I dont even know if it can be done. I have an image.dll which gets dropped to C:\windows\system32 and that cmd file you helped me with to register it (Regsvr32 %SystemRoot%\system32\image.dll /s) now what the dll does is it adds an image to the right click menu when you right click on your desktop. I would like to make the image that is in the right click menu, when clicked on open the systems properties (same place that opens when you right click on my computer and go to properties). But I have no and I mean no idea on how to do that. Any ideas? I have uploaded the image.dll

P.S. I didnt not make the dll, I download it and used reshacker to add my own image =) but I uploaded the one I downloaded so it has not been edited

Image.rar

Edited by JayDogg
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...