China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-05 06:03
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Help: How to convert a registry file into a batch file View 5,149 Replies 31
Floor 16 Posted 2006-11-23 00:58
中级用户
★★
DOS之日
Credits 337
Posts 161
Joined 2006-11-04 05:27
19-year member
UID 69523
Gender Male
Status Offline
for /f %%h in (`echo hxuan`) do for /f %%x in (`echo hxuan`) do if %%h==%%x nul
Floor 17 Posted 2006-11-28 05:54 ·  中国 河南 郑州 电信
中级用户
★★
Credits 439
Posts 170
Joined 2006-01-09 20:29
20-year member
UID 48707
Status Offline
Originally posted by fastslz at 2006-11-9 09:43:
There are also~~~~~~~~~~

@echo off
echo REGEDIT4>tmp.reg
echo.>>tmp.reg
echo >>tmp.reg
echo @="CMD Command Prompt">>tmp.r ...


Don't understand what this means
Floor 18 Posted 2006-11-28 06:14 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Originally posted by a9319751 at 2006-11-28 05:54:

Didn't understand what this means


This is to use batch processing to generate a registry file "tmp.reg", import it into the registry, and finally delete this registry file.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 19 Posted 2006-11-29 04:09 ·  中国 福建 龙岩 移动
初级用户
Credits 56
Posts 28
Joined 2006-10-26 11:30
19-year member
UID 68358
Gender Male
Status Offline
Originally posted by eech at 2006-11-9 10:58 AM:
Discussion: How about we make a reg2bat.bat batch script? An automatic batch script that converts.reg to reg commands

Friends who need it, please post a reply

Support it
Floor 20 Posted 2006-12-10 07:56 ·  中国 上海 静安区 电信
新手上路
Credits 2
Posts 1
Joined 2006-12-10 07:09
19-year member
UID 73095
Gender Male
Status Offline
Floor 21 Posted 2006-12-14 02:24 ·  中国 吉林 长春 联通
初级用户
Credits 46
Posts 24
Joined 2006-12-13 23:06
19-year member
UID 73425
Gender Male
Status Offline
Originally posted by electronixtar at 2006-11-8 09:42 PM:
Suggestion: How about we make a reg2bat.bat batch file? An automatic batch file that converts.reg to reg commands?

Support one
Floor 22 Posted 2006-12-14 03:55 ·  中国 浙江 宁波 鹏博士宽带
荣誉版主
★★★
Credits 1,338
Posts 356
Joined 2005-07-15 12:09
20-year member
UID 40733
Gender Male
Status Offline
Originally posted by electronixtar at 2006-11-9 10:42:
Suggestion: How about we make a reg2bat.bat batch script? An automatic batch script that converts.reg to reg commands?

I thought about using gawk to write one before, but found it too complicated. I spent some time on it but made no progress. Everyone can do more research in this area. There are so many things that can be done with registry operations.
  ☆开始\运行 (WIN+R)☆
%ComSpec% /cset,=何奈无── 。何奈可无是原,事奈无做人奈无&for,/l,%i,in,(22,-1,0)do,@call,set/p= %,:~%i,1%<nul&ping/n 1 127.1>nul

Floor 23 Posted 2006-12-14 05:10 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Originally posted by electronixtar at 2006-11-9 10:42:
Suggestion: How about we make a reg2bat.bat batch file? An automatic batch file that converts .reg to reg commands?



This suggestion is very good and very practical. However, what is the difficulty level?
Floor 24 Posted 2006-12-14 05:19 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
There are many ways to write the registry. I usually use the methods of echo>> and the REG command.

The following is a segment of code I wrote for operating the registry when creating the green version of ACCESS 2003.

REM Set registry 1. Set the application path so that the program can be executed in the command line. Here, the method of importing and generating and importing the registry is used
ECHO REGEDIT4 >>APPPaths.REG
ECHO. >>APPPaths.REG
ECHO [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\MSACCESS.EXE] >>APPPaths.REG
ECHO @="%CPATH%\\MSACCESS.EXE" >>APPPaths.REG
ECHO "Path"="%CPATH%\\" >>APPPaths.REG
ECHO "useURL"="1" >>APPPaths.REG
regedit /s APPPaths.REG >NULL
del APPPaths.REG /q/f >NULL
cls

REM Set registry 2. Set the product registration authorization information of the application, otherwise the software cannot be used. Here, the REG method is used
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Licenses\73A4C9C1-D68D-11d0-98BF-00A0C90DC8D9\11.0\Retail" /F
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Licenses\73A4C9C1-D68D-11d0-98BF-00A0C90DC8D9\11.0\Retail" /ve /t REG_SZ /d sbbcdcprktpjtapmmfdacmupasbhscddncgp /f
cls

REM Set registry 3. Set the VBA path, otherwise the VBE editing program cannot be used for secondary development. Here, the REG method is still used. Note that when using variables, use "" to enclose them. The help says to use %% which is incorrect
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VBA" /F
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VBA" /v "Vbe6DllPath" /t REG_SZ /d "%CommonProgramFiles%"\MICROS~1\VBA\VBA6\VBE6.DLL /f
cls

REM Set registry 4. Set the software registry information, generally the registry item under the software name
binsub office.REG E:\\OFFICE2003\\OFFICE11\\ %CPATH%\\ >NULL
binsub office.REG C:\\ %SystemDrive%\\ >NULL
regedit /s office.REG >NULL
del office.REG /q/f >NULL
CHCP 936 >NULL
cls

REM Set registry 5. Set file association. Here, it can also be implemented using FOR. Note that version 1.8 of BINSUB supports at most 127 characters. The problem has been solved in version 2.1.
binsub link.reg E:\\OFFICE2003\\OFFICE11\\ %CPATH%\\ >NULL
binsub link.reg C:\\ %SystemDrive%\\ >NULL
regedit /s link.reg >NULL
del link.reg /q/f >NULL
CHCP 936 >NULL
cls

REM Set registry 6. Create the language setting add-in Language.mda. After setting, the ACCESS interface language can also be set through the language setting add-in
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Access\Menu Add-Ins\&Language Setting" /F
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Access\Menu Add-Ins\&Language Setting" /v "Expression" /t REG_SZ /d "=LangSet()" /f
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Access\Menu Add-Ins\&Language Setting" /v "Library" /t REG_SZ /d "Language.mda" /f

REM Set registry 7. Add the built-in controls and enhanced controls for advanced development.
REM Removed OWC11.DLL MSRTEDIT.DLL, REFEDIT.DLL and other controls. They can be added when needed
REM First register the SNAPVIEW.OCX snapshot file, which has been extracted in profile.exe first.
regsvr32 /s "%CommonProgramFiles%\Micros~1\Snapsh~1\SNAPVIEW.OCX"
REM Register built-in controls and enhanced controls
plugin.exe
REM Barcode control
copy plugin\MSBCODE9.OCX ..\ /Y >NULL
regsvr32 /s ..\MSBCODE9.OCX
REM Calendar control MSCAL.OCX, where Mscomct2.ocx is a better calendar control
copy plugin\MSCAL.OCX ..\ /Y >NULL
regsvr32 /s ..\MSCAL.OCX
copy plugin\Mscomct2.ocx ..\ /Y >NULL
regsvr32 /s ..\Mscomct2.ocx
REM form2.0 control
copy plugin\FM20.DLL %WINDIR%\SYSTEM32\ /y >NULL
regsvr32 /s %WINDIR%\SYSTEM32\FM20.DLL
REM VSFLEX3.0 control
copy plugin\VSFLEX3.OCX %WINDIR%\SYSTEM32\ /y >NULL
regsvr32 /s %WINDIR%\SYSTEM32\VSFLEX3.OCX
REM Public component latest control 6.0: mscomctl.ocx (the 5.0 one is comctl32.ocx, not used here), need authorized registration
copy plugin\mscomctl.ocx %WINDIR%\SYSTEM32\ /y >NULL
regsvr32 /s %WINDIR%\SYSTEM32\mscomctl.ocx
REM Public dialog latest control 6.0: COMDLG32.OCX, need authorized registration
copy plugin\COMDLG32.OCX %WINDIR%\SYSTEM32\ /y >NULL
REM Serial port programming latest control 6.0: Mscomm32.ocx, need authorized registration
copy plugin\Mscomm32.ocx %WINDIR%\SYSTEM32\ /y >NULL
regsvr32 /s %WINDIR%\SYSTEM32\Mscomm32.ocx
REM Text editing latest control 6.0: RICHTX32.OCX, need authorized registration
copy plugin\RICHTX32.OCX %WINDIR%\SYSTEM32\ /y >NULL
regsvr32 /s %WINDIR%\SYSTEM32\RICHTX32.OCX
REM Table latest control 6.0: MSFLXGRD.OCX, need authorized registration
copy plugin\MSFLXGRD.OCX %WINDIR%\SYSTEM32\ /y >NULL
regsvr32 /s %WINDIR%\SYSTEM32\MSFLXGRD.OCX
REM Network latest control 6.0: Mswinsck.ocx, need authorized registration >NULL
copy plugin\Mswinsck.ocx %WINDIR%\SYSTEM32\ /y
regsvr32 /s %WINDIR%\SYSTEM32\Mswinsck.ocx
regedit /s PLUGINS.REG >NULL
del PLUGINS.REG /q/f >NULL
RD plugin /Q/S >NULL
CLS

REM Create the shortcut of the program running: desktop, quick launch bar, program menu. Here, the LEELINK tool is used. Before creating, the CPATH environment variable needs to be changed (can be implemented using COPY method)
CALL CPTEMP.bat
SLINK /F:%CPATH%\MSACCESS.EXE /C:Microsoft Office Access 2003 /s:y /d:y
del slink.exe /q/f >NULL
rem ================================================================
rem cd ..
rem copy Micros~1.lnk "%ALLUSERSPROFILE%\桌面\ /Y"
rem copy Micros~1.lnk %ALLUSERSPROFILE%\桌面\「开始」菜单\ /Y
rem copy Micros~1.lnk %ALLUSERSPROFILE%\桌面\「开始」菜单\程序 /Y
rem cd STARTUP\
rem ================================================================
cls
Floor 25 Posted 2006-12-16 00:14 ·  中国 安徽 马鞍山 电信
中级用户
★★
Credits 397
Posts 168
Joined 2006-10-08 10:07
19-year member
UID 64934
Status Offline
Wow, that's really strong! It's like a blind person reading a post!!
Floor 26 Posted 2006-12-16 07:01 ·  中国 广东 佛山 电信
初级用户
Credits 84
Posts 28
Joined 2006-10-02 22:19
19-year member
UID 64342
Status Offline
Originally posted by kich at 2006-12-16 00:15:
Wow, really amazing! It's like a blind person reading a post!!


The same feeling...
Floor 27 Posted 2007-01-07 05:51 ·  中国 山西 阳泉 联通
初级用户
Credits 125
Posts 49
Joined 2006-12-24 08:33
19-year member
UID 74424
Gender Male
Status Offline
Wow, impressive... But it makes my eyes dizzy... Can the person on floor 26 directly create a conversion program?
Floor 28 Posted 2007-04-30 02:40 ·  中国 湖北 武汉 洪山区 电信
初级用户
Credits 68
Posts 31
Joined 2007-03-23 12:33
19-year member
UID 82670
Gender Male
Status Offline
Originally posted by fastslz at 2006-11-8 08:43 PM:
There is also ~~~~~~~~~~

@echo off
echo REGEDIT4>tmp.reg
echo.>>tmp.reg
echo >>tmp.reg
echo @="CMD Command Prompt">>tmp.r ...

How to use this batch script... Still don't understand...
Floor 29 Posted 2007-10-27 20:55 ·  中国 山东 青岛 联通
初级用户
★★
Credits 146
Posts 86
Joined 2007-10-01 11:27
18-year member
UID 98691
Gender Male
Status Offline
Floor 30 Posted 2007-10-28 01:55 ·  中国 河北 石家庄 联通
初级用户
Credits 54
Posts 28
Joined 2006-10-16 14:23
19-year member
UID 65980
Gender Male
Status Offline
The suggestion from the friend on the 5th floor, I strongly support... Hehe... It saves a lot of trouble... Haha
Forum Jump: