Batch file 获取注册表项的值

Batch file 获取注册表项的值,batch-file,dos,command-prompt,Batch File,Dos,Command Prompt,我有一个批处理脚本,用于检查注册表项是否存在,如果存在,则打开Internet explorer。我现在要做的是获取注册表项的值并将其放入URL中。我该怎么做 @echo off reg query HKLM\Software\Test\Monitor\Settings if errorlevel 1 goto not_exist goto exist :not_exist :exist start "Test" "%ProgramFiles%\Internet Explorer\iexpl

我有一个批处理脚本,用于检查注册表项是否存在,如果存在,则打开Internet explorer。我现在要做的是获取注册表项的值并将其放入URL中。我该怎么做

@echo off
reg query HKLM\Software\Test\Monitor\Settings
if errorlevel 1 goto not_exist
goto exist

:not_exist

:exist
start "Test" "%ProgramFiles%\Internet Explorer\iexplore.exe" http://localhost:/dashboard.php

感谢所有人的帮助。

给你,应该是不言自明的评论。如果你有任何问题,请告诉我

@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%

谢谢,真的很有用!:)@esac
REG.EXE
version和请求的密钥在WinXP SP3上执行时出现,但脚本工作:)执行了类似的操作
(REG query%THEME\u REGKEY%/v%THEME\u REGVAL%2>nul | |(转到:SETUP\u 001))>nul