服务器系统集成及数据服务中心

 

一级栏目
一级栏目
一级栏目
一级栏目
一级栏目
一级栏目
一级栏目
一级栏目
锟斤拷锟斤拷锟斤拷锟斤拷…………………………………………………………………………………………>>>

DOS应用-批处理脚本

批处理的循环脚本

第一次运行 执行命令A
第二次运行 执行命令B
第三次运行 执行命令A
................
原理很简单
用if exist 判断
第一次运行时,不存在指定文件 ,则运行命令A,并创建指定文件
第二次运行时,指定文件存在 ,则运行命令B,并删除指定文件
第三次运行,又不存在指定文件,............

两个实例

1. 显示/隐藏文件的扩展名 (运行并刷新后生效)

@echo off
if not exist c:windows\wind.txt (
break>c:windows\wind.txt
reg add hkcu\software\microsoft\windows\currentversion\explorer\advanced /v hidefileext /t reg_dword /d 0 /f
) else (
reg add hkcu\software\microsoft\windows\currentversion\explorer\advanced /v hidefileext /t reg_dword /d 1 /f
del c:windows\wind.txt
)

2. 启用/断开宽带连接

@echo off
if not exist c:windows\wind.txt (
break>c:windows\wind.txt
rasphone /d 宽带连接
) else (
rasphone /h 宽带连接
del c:windows\wind.txt
) DOS

发布时间:2020/5/20 阅读:4062次 来源:
 


 
锟斤拷锟斤拷锟斤拷锟斤拷分类
   
  行业新闻
 
  公司动态
 
  技术资料
 
  电脑维修
 
  恢复案例
 
  SQL数据库
 
  磁盘阵列
 
  服务器
 
  财务软件
 
  网络问题
 
  linux-XFS
 
  苹果电脑&系统
 
  安卓系统相关
 
  办公文件
 
  操作系统
 
  日常生活(烟台)
 
  网站相关
 
   
 
友情链接
 
 
 
 
 
   
公司地址:烟台电脑市场#308
电话:0535-6688830 E-Mail:163@163.com
Copyright©2011-2012 烟台瑞驰科贸有限公司 All Rights Reserved.
鲁ICP备11014811号-1
您是本站第 位访问者