doc if for goto :

本文详细介绍了如何通过在Windows的启动文件夹中添加快捷方式来实现程序的开机自启动,以及使用批处理命令进行条件判断、循环操作等高级功能。包括choice、if、for等命令的具体应用实例。

开始-运行 shell:startup 添加快捷方式为开机启动
choice /c: abc /m “提示信息” 默认 Y/N
if errorlevel = 1 goto 选a就是1
if = 2 goto 选b就是2
if =3 goto 选c就是和i3

if == “字符串” goto end 如果等于
if errorlevel 1 goto x 如果返回数字
if exist 文件名 goto y 如果 有这个文件
:x 函数类
echo 哈哈
:y 函数类
echo 呵呵
;end goto后是函数 end也是
echo end

for [%%f] in (一个范围) do 其他 如果量f在范围中就执行后面的
for %%c in (*.bat *.doc) do type %%c 如果c在 bat 或者 doc类型的文件中就显示

With myWord Set myDoc = .Documents.Add(Template:=Sheet2.Cells(1, 11).value & "\template\CE Marking.doc", Visible:=True) With .Selection For i = 1 To 9 .GoTo what:=wdGoToBookmark, Name:="Client_" & i .TypeText Text:=client .GoTo what:=wdGoToBookmark, Name:="Denomination_" & i .TypeText Text:=Denomination Next For i = 7 To 9 .GoTo what:=wdGoToBookmark, Name:="density1_" & i .TypeText Text:=density1 .GoTo what:=wdGoToBookmark, Name:="density2_" & i .TypeText Text:=density2 .GoTo what:=wdGoToBookmark, Name:="density3_" & i .TypeText Text:=density3 .GoTo what:=wdGoToBookmark, Name:="Water_absorption_" & i .TypeText Text:=water_absorption .GoTo what:=wdGoToBookmark, Name:="porosity_" & i .TypeText Text:=porosity Next .GoTo what:=wdGoToBookmark, Name:="density1_1" .TypeText Text:=density3 .GoTo what:=wdGoToBookmark, Name:="density1_2" .TypeText Text:=density3 .GoTo what:=wdGoToBookmark, Name:="density1_3" .TypeText Text:=density3 .GoTo what:=wdGoToBookmark, Name:="density1_4" .TypeText Text:=density3 .GoTo what:=wdGoToBookmark, Name:="density1_5" .TypeText Text:=density3 .GoTo what:=wdGoToBookmark, Name:="density1_6" .TypeText Text:=density3 .GoTo what:=wdGoToBookmark, Name:="density2_1" .TypeText Text:=density3 .GoTo what:=wdGoToBookmark, Name:="density2_2" .TypeText Text:=density3 .GoTo what:=wdGoToBookmark, Name:="density2_4" .TypeText Text:=density3 .GoTo what:=wdGoToBookmark, Name:="density2_5" .TypeText Text:=density3 .GoTo what:=wdGoToBookmark, Name:="density2_6" .TypeText Text:=density3 .GoTo what:=wdGoToBookmark, Name:="Abrasion_7" .TypeText Text:=Abrasion .GoTo what:=wdGoToBookmark, Name:="Abrasion_8" .TypeText Text:=Abrasion .GoTo what:=wdGoToBookmark, Name:="Slip_resistance_3" .TypeText Text:=Slip_resistance .GoTo what:=wdGoToBookmark, Name:="Slip_resistance_4" .TypeText Text:=Slip_resistance .GoTo what:=wdGoToBookmark, Name:="Slip_resistance_7" .TypeText Text:=Slip_resistance .GoTo what:=wdGoToBookmark, Name:="Slip_resistance_8" .TypeText Text:=Slip_resistance For i = 1 To 7 .GoTo what:=wdGoToBookmark, Name:="Flexural_strength_" & i .TypeText Text:=Flexural_strength Next .GoTo what:=wdGoToBookmark, Name:="Compressive_strength_8" .TypeText Text:=Compressive_strength .GoTo what:=wdGoToBookmark, Name:="Flexural_strength_9" .TypeText Text:=Flexural_strength For i = 2 To 6 Step 2 .GoTo what:=wdGoToBookmark, Name:="Frost1_" & i .TypeText Text:=Frost_flexural .GoTo what:=wdGoToBookmark, Name:="Frost2_" & i .TypeText Text:=Frost_flexura2 Next .GoTo what:=wdGoToBookmark, Name:="Frost1_7" .TypeText Text:=Frost_flexural .GoTo what:=wdGoToBookmark, Name:="Frost1_8" .TypeText Text:=Frost_compressive1 .GoTo what:=wdGoToBookmark, Name:="Frost1_9" .TypeText Text:=Frost_flexural .GoTo what:=wdGoToBookmark, Name:="Frost2_7" .TypeText Text:=Frost_flexura2 .GoTo what:=wdGoToBookmark, Name:="Frost2_8" .TypeText Text:=Frost_compressive2 .GoTo what:=wdGoToBookmark, Name:="Frost2_9" .TypeText Text:=Frost_flexura2 .GoTo what:=wdGoToBookmark, Name:="fixing_resistance_5" .TypeText Text:=fixing_resistance .GoTo what:=wdGoToBookmark, Name:="fixing_resistance_6" .TypeText Text:=fixing_resistance End With myDoc.SaveAs FileName:=savepath myDoc.Close False Set myDoc = Nothing End With请逐行解释上述代码
10-29
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值