回复 3# hu1616
本来想以楼主给的注册表项为例,但我电脑没有ProgramFilesDir这个项,所以就到CurrentVersion为例,我这已试OK,你把需要打开的注册表项赋值给到变量%x%,保存ANSI编码,cmd后缀,管理员权限打开。
赋值方案1- @echo off
- taskkill /im regedit.exe /f >nul 2>nul
- set "X=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion"
- reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit" /v LastKey /t REG_SZ /d "计算机\%x%" /f >nul 2>nul
- start regedit
- exit
复制代码 赋值方案2- @echo off
- taskkill /im regedit.exe /f >nul 2>nul
- for /f "tokens=1 delims=" %%a in ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion") do (set X=%%a)
- reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit" /v LastKey /t REG_SZ /d "计算机\%x%" /f >nul 2>nul
- start regedit
- exit
复制代码
|