中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-10 18:04
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » reg2bat
Printable Version  4,087 / 14
Floor1 vkill Posted 2006-11-20 07:09
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
After looking at the recent few posts about reg2bat, I think it's quite practical when written out. I wrote it last night, everyone can test it.

The sed usage is not good, I feel there are a lot of garbage codes, hope the experts can give pointers.

Sed download: http://www.yx127.com/tools/gsed_407x.rar




[ Last edited by vkill on 2006-11-21 at 09:31 AM ]
Floor2 vkill Posted 2006-11-20 07:09
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
Hope it's useful, heh heh ~ Supports *.bat

[ Last edited by vkill on 2006-11-20 at 07:10 AM ]
Floor3 3742668 Posted 2006-11-20 13:34
荣誉版主 Posts 718 Credits 2,013
The key of reg2bat is not in the format of reg, but in the key value type of reg.
I remember that last time I transferred a post, which described in detail the representation methods of different types of key values.
Only when the key values of the following several types can be restored, can reg2bat be truly realized:
0 reg_none
1 reg_sz
2 reg_expand_sz
3 reg_binary
4 reg_dword, reg_dword_little_endian
5 reg_dword_big_endian
6 reg_link
7 reg_multi_sz
8 reg_resource_list
9 reg_full_resource_descriptor
10 reg_resource_requirements_list
If it is to be completed purely through batch processing, it is recommended to implement it in the way of looking up a table. For example, the following is a script that replaces the IP address with hex(7) type, without error handling, and can only handle the IP address:

Written a long time ago, now it seems that the code is very immature, and it is posted for reference.
Floor4 vkill Posted 2006-11-21 09:08
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
3742668 moderator

sed "s/=/=REG_SZ=/" |sed "s/=REG_SZ=dword:/=REG_DWORD=/;s/=REG_SZ=hex:/=REG_BINARY=/;s/=REG_SZ=hex(7):/=REG_MULTI_SZ=/;s/=REG_SZ=hex(2):/=REG_EXPAND_SZ=/"

The above paragraph is to judge the key value type of reg and restore it.

[ Last edited by vkill on 2006-11-21 at 09:49 AM ]
Floor5 vkill Posted 2006-11-21 09:37
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
I tested by exporting the reg to experiment, oh
Floor6 qpmgljf Posted 2007-01-08 04:47
初级用户 Posts 49 Credits 125
Lz楼主 ah... no good... after dragging in, nothing is displayed. Dragging other files also doesn't display. It just shows the path of the dragged-in file... Can you edit it again? Urgent oh.~~~~
Floor7 yxii001 Posted 2007-01-17 23:44
新手上路 Posts 9 Credits 18
The first time I dragged it in, it didn't work. The second time, it exited, and there were no prompts during that period.
Floor8 zh159 Posted 2007-01-17 23:55
金牌会员 Posts 1,467 Credits 3,687
Originally posted by qpmgljf at 2007-1-7 15:47:
楼主啊。。。。不行。。。。。拖进去后什么也不显示。拖别的文件也不显示。都是只显示一个拖进去的文件的路径而已啊。。。。
Can you recompile it? ...

It seems that the double quotes in the %life_r% variable part were not properly placed, causing errors with directories containing spaces
Floor9 vkill Posted 2007-01-18 08:35
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
Originally posted by zh159 at 2007-1-17 23:55:

It seems that the double quotes in the %life_r% variable part were not properly placed, causing errors with directories containing spaces.

Hey, I just realized today, it's a super big mistake!
Floor10 bingxiao20 Posted 2007-04-30 02:46
初级用户 Posts 31 Credits 68
Is this modified? It's about that variable.
Floor11 ghost2008 Posted 2007-09-10 11:17
新手上路 Posts 6 Credits 12
Just change it to this. Enter the REG file you want to convert and it will generate a BAT file in one second. It's 100% practical after using it.
@echo off
:manu
cls
echo.
echo Please enter the name of the registry file to convert (full path):
set object=
set /p object=
echo %object%|find /i ":" && goto :do

echo.
echo Error! The full path and registry file name are required!
echo.
echo For example: D:\soft\anti.reg
echo.
echo Press any key to return and re-enter...
pause>nul
cls
goto manu

:do
echo.
for /f "tokens=*" %%a in ('type %object%') do echo echo %%a^>^>temp1234.reg>>%object%.bat
echo regedit /s temp1234.reg>>%object%.bat
echo del /f /q /a temp1234.reg>>%object%.bat
echo.
echo Has been converted to %object%.bat! Press any key to exit...
pause>nul
exit
Floor12 hdzc Posted 2007-10-27 08:51
初级用户 Posts 86 Credits 146
Post by ghost2008 on the 11th floor: Very useful
Floor13 dato Posted 2007-10-27 12:56
高级用户 Posts 377 Credits 916
The method of ghost2008

Actually, I used the regedit /s command when implementing the desktop before, but this command will prompt a permission issue for restricted users, while the reg add method has no problem.
Floor14 freesoft00 Posted 2007-11-28 15:00
新手上路 Posts 2 Credits 4
vkill, please correct your code for me. I don't know how.
Floor15 vkill Posted 2007-12-09 15:36
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
Originally posted by freesoft00 at 2007-11-28 15:00:
vkill, please correct your code. I don't know how.

I think it's still better to use reg2inf. Is there any bug in that?
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023