Question

I need some help with this problem...

I want to use a *.bat file to create and add a *.reg to system. If I try manually on CMD prompt, it works. i.e:

~~ prompt window opened ~~

copy con "myregister.reg"

~~ I paste my *.reg content here ~~

~~ I press Ctrl+Z ~~

^Z

~~ I press Enter ~~

~~ my register has been created ~~

But if I try to create a *.bat with this content:

copy con "myregister.reg"
 Windows Registry Editor Version 5.00

 [HKEY_CURRENT_USER\Software\Developer]

 [HKEY_CURRENT_USER\Software\Developer\HisSoftware]

 [HKEY_CURRENT_USER\Software\Developer\HisSoftware\Jumplist]
 "Recent sessions"=hex(7):41,00,66,00,74,00,65,00,72,00,6d,00,61,00,72,00,6b,00,\
 ...
^Z

...it doesn't works.

What can I do?

I'm sorry for my poor english :$

Was it helpful?

Solution

This method has some limitations with certain characters that need to be escaped with ^

Like these: ^) ^& ^< ^> ^|

@echo off
(
echo.Windows Registry Editor Version 5.00
echo.
echo.[HKEY_CURRENT_USER\Software\Developer]
echo.
echo.[HKEY_CURRENT_USER\Software\Developer\HisSoftware]
echo.
echo.[HKEY_CURRENT_USER\Software\Developer\HisSoftware\Jumplist]
echo. "Recent sessions"=hex(7):41,00,66,00,74,00,65,00,72,00,6d,00,61,00,72,00,6b,00,\
) >file.reg
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top