Board logo

标题: [求助]个性化鼠標右键 IF...Goto...&start(已解决) [打印本页]

作者: ad2033     时间: 2007-11-22 22:15    标题: [求助]个性化鼠標右键 IF...Goto...&start(已解决)

@echo off
title 个性化鼠標右键
echo 背景编号:
echo 1=背景1        2=背景2        3=背景3
echo off
:index
set /p img=输入背景编号:
if "%img%"=="1" goto cp1
if "%img%"=="2" goto cp2
if "%img%"=="3" goto cp3
::上面如果输入其它所有字符则回显:请正确输入上面已有的编号! 并goto index 应该怎么写?

:cp1
copy ContextBG-mm1.dll "%SystemRoot%\" >nul"

:cp2
copy ContextBG-mm2.dll "%SystemRoot%\" >nul"

:cp3
copy ContextBG-mm3.dll "%SystemRoot%\" >nul"

::下面的问题是3个命令都运行了..我想让它根据上面的输入的编号来执行对应的start.应该怎么写..?
前提:如果指定的目录存在该文件则执行start
如来不存在则回显:"设置背景失败.可能……"并 goto index


IF EXIST "%SystemRoot%\ContextBG-mm1.dll" GOTO start
IF EXIST "%SystemRoot%\ContextBG-mm2.dll" GOTO start2
IF EXIST "%SystemRoot%\ContextBG-mm3.dll" GOTO start3

:start
regsvr32 %SystemRoot%\ContextBG-mm1.dll

:start2
regsvr32 %SystemRoot%\ContextBG-mm2.dll

:start3
regsvr32 %SystemRoot%\ContextBG-mm3.dll

::如果执行成功..回显:……  怎么写?
echo 设置成功!如果看不到效果请注消或重启一次就OK!
pause & exit



请各位达人.元老..指点一下. 谢谢!

[ Last edited by ad2033 on 2007-11-23 at 03:11 PM ]
作者: sinbao     时间: 2007-11-23 13:22

@echo off
title 个性化鼠標右键
echo 背景编号:
echo 1=背景1        2=背景2        3=背景3

:index
set /p img=输入背景编号:
if "%img%"=="1" goto cp
if "%img%"=="2" goto cp
if "%img%"=="3" goto cp
goto index

:cp
copy "ContextBG-mm%img%.dll" "%SystemRoot%" >nul && regsvr32 "%SystemRoot%\ContextBG-mm%img%.dll" && echo 设置成功!如果看不到效果请注消或重启一次就OK!&& exit || echo 设置失败
[ Last edited by sinbao on 2007-11-23 at 01:37 PM ]
作者: ad2033     时间: 2007-11-23 14:36
Thanks sinbao
问题解决!


[ Last edited by ad2033 on 2007-11-23 at 03:08 PM ]