Abs*_*Abs 7 dos batch-file 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\iexplore.exe" http://localhost:/dashboard.php
Run Code Online (Sandbox Code Playgroud)
谢谢大家的帮助.
esa*_*sac 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%
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
38745 次 |
| 最近记录: |