在批处理中使用【if】和【goto】的例子

在批处理中使用【if】和【goto】的例子:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
@echo off
rem This script assumes that REAPER is installed in C:\Program Files\REAPER
rem If you have it installed somewhere else, modify this next line to point to the right folder
rem OR pass it to the script like: reaper-to-usb.bat "d:\REAPER"
set REAPERDIR="C:\Program Files\REAPER"
if not '%1'=='' set REAPERDIR=%1
 
 
cls
:tryagain
echo Welcome to the REAPER-TO-USB installation script
echo -
echo This will copy REAPER and your current REAPER settings to your USB drive.
echo -
echo Note: you may wish to make sure that you don't have any excess media
echo       in your REAPER folder or it will be copied as well!
echo -
echo Enter the drive letter key where your USB drive or removable media is installed
echo (i.e. D: or E: or F: etc)
set dlet=
set /p "dlet=Drive letter (or ENTER to abort): "
 
if /I "%dlet%"=="" goto abort
if /I "%dlet%"=="A:" goto suc
if /I "%dlet%"=="B:" goto suc
if /I "%dlet%"=="C:" goto suc
if /I "%dlet%"=="D:" goto suc
if /I "%dlet%"=="E:" goto suc
if /I "%dlet%"=="F:" goto suc
if /I "%dlet%"=="G:" goto suc
if /I "%dlet%"=="H:" goto suc
if /I "%dlet%"=="I:" goto suc
if /I "%dlet%"=="J:" goto suc
if /I "%dlet%"=="K:" goto suc
if /I "%dlet%"=="L:" goto suc
if /I "%dlet%"=="M:" goto suc
if /I "%dlet%"=="N:" goto suc
if /I "%dlet%"=="O:" goto suc
if /I "%dlet%"=="P:" goto suc
if /I "%dlet%"=="Q:" goto suc
if /I "%dlet%"=="R:" goto suc
if /I "%dlet%"=="S:" goto suc
if /I "%dlet%"=="T:" goto suc
if /I "%dlet%"=="U:" goto suc
if /I "%dlet%"=="V:" goto suc
if /I "%dlet%"=="W:" goto suc
if /I "%dlet%"=="X:" goto suc
if /I "%dlet%"=="Y:" goto suc
if /I "%dlet%"=="Z:" goto suc
 
 
cls
echo Bad drive letter entered, please try again!
 
goto tryagain
 
 
:suc
 
mkdir %dlet%\REAPER
xcopy /E /Y "%appdata%\reaper\*" %dlet%\REAPER
xcopy /E /Y %REAPERDIR%\* %dlet%\REAPER
 
if not exist "%dlet%\reaper\reaper.exe" goto fail
 
cls
echo REAPER is now installed on your USB drive in the REAPER folder.
echo Just launch REAPER.EXE from your USB drive to use it. Have fun!
echo -
goto end
 
:abort
 
echo Copy aborted! You can now close this window!
echo -
goto end
 
:fail
 
echo -
echo Copy appears to have failed!
goto end
 
:end
pause

  

 
posted @   奥兰王子  阅读(82)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全网最简单!3分钟用满血DeepSeek R1开发一款AI智能客服,零代码轻松接入微信、公众号、小程
· .NET 10 首个预览版发布,跨平台开发与性能全面提升
· 《HelloGitHub》第 107 期
· 全程使用 AI 从 0 到 1 写了个小工具
· 从文本到图像:SSE 如何助力 AI 内容实时呈现?(Typescript篇)
点击右上角即可分享
微信分享提示