2010-07-09 14 views
7

레지스트리 키가 있는지 확인하고 존재하는 경우 Internet Explorer를 여는 일괄 처리 스크립트가 있습니다. 지금 내가 원하는 것은 해당 등록 키 값을 가져 와서 URL에 넣는 것입니다. 어떻게해야합니까? 모든 도움을 주셔서 감사합니다.레지스트리 키 값 가져 오기

답변

19

여기에 설명과 함께 설명이 있어야합니다. 궁금한 점이 있으면 알려주세요.

@echo off 

set THEME_REGKEY=HKLM\Software\Microsoft\Windows\CurrentVersion\Themes 
set THEME_REGVAL=ThemeName 

REM Check for presence of key first. 
reg query %THEME_REGKEY% /v %THEME_REGVAL% 2>nul || (echo No theme name present! & exit /b 1) 

REM query the value. pipe it through findstr in order to find the matching line that has the value. only grab token 3 and the remainder of the line. %%b is what we are interested in here. 
set THEME_NAME= 
for /f "tokens=2,*" %%a in ('reg query %THEME_REGKEY% /v %THEME_REGVAL% ^| findstr %THEME_REGVAL%') do (
    set THEME_NAME=%%b 
) 

REM Possibly no value set 
if not defined THEME_NAME (echo No theme name present! & exit /b 1) 

REM replace any spaces with + 
set THEME_NAME=%THEME_NAME: =+% 

REM open up the default browser, searching google for the theme name 
start http://www.google.com/search?q=%THEME_NAME% 
+0

정말 고맙습니다. :) – Abs

+0

WinXP SP3에서 실행될 때 @esac'REG.EXE' 버전과 요청 된 키가 나타나지만 스크립트가 작동합니다. – BalticMusicFan

+0

다음과 같은 형태입니까? (reg query % THEME_REGKEY %/v % THEME_REGVAL % 2> nul || (goto : SETUP_001))> nul' – BalticMusicFan