windows批处理基础练习(学习Ing)
来源:互联网 发布:php 数组截取指定位置 编辑:程序博客网 时间:2024/06/14 09:29
1
<span style=
"font-size:16px;"
>@
echo
off<br>net use M:
/del
/yes
<br>net use M: \\192.168.100.163\
file
123456
/user
:administrator<br><
/span
>
1
<span style=
"font-size:16px;"
>@
echo
off<br>
dir
%1<br>
type
%2<br><
/span
>
1
<span style=
"font-size:16px;"
>@
echo
off<br>
if
"%1"
==
"a"
echo
%1=a<br><
/span
>
1
<span style=
"font-size:16px;"
>@
echo
off<br>
if
exist d:\2.txt
type
d:\2.txt<br>
echo
2.txt is not exist<br><
/span
>
1
<span style=
"font-size:16px;"
>@
echo
off<br>
netstat
-ano|findstr
"Zabbix Agent"
<br>
if
ERRORLEVEL 1 (net stop
"Zabbix Agent"
& net start
"Zabbix Agent"
&&
echo
Zabbix Agent已启动)
else
(
echo
"Zabbix Agent"
is running)<br><
/span
>
1
2
3
4
5
6
@
echo
off
:again
:
netstat
-ano|findstr
"Zabbix Agent"
:
if
ERRORLEVEL 1 (net stop
"Zabbix Agent"
& net start
"Zabbix Agent"
&&
echo
Zabbix Agent已启动)
else
(
echo
"Zabbix Agent"
is running)
ping
-n 10 10.15.98.190 >nul
goto again
1
2
3
4
5
@
echo
off
if
"%1"
==
"h"
goto begin
mshta vbscript:createobject(
"wscript.shell"
).run(
"%~nx0 h"
,0)(window.close)&&
exit
:begin
rem 下面粘贴上批处理的命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
C:\Users\Administrator>
file
ftp2-192.bat
@
echo
off
Title mktdt00同步程序,请勿关闭!
Rem
###################
Rem
type
mktdt00.txt
Rem
open
10.10.2.192
Rem mktdt00
Rem mktdt00 密码为空使用空行
Rem put r:\mktdt00.txt
Rem bye
Rem
###################
:again
ftp
-s:D:\mktdt00.txt
echo
%Date:~0,4%-%Date:~5,2%-%Date:~8,2% %Time:~0,2%:%Time:~3,2%:%Time:~6,2%更新完成,20s后更再新......
ping
-n 20 127.0.0.1 >nul
goto again
C:\Users\Administrator>
file
D:\mktdt00.txt
open
10.15.44.162
mktdt00
mktdt00
put r:\mktdt00.txt
bye
1
<span style=
"font-size:16px;"
>C:\Users\Administrator>forfiles
/p
d:\
/s
/m
*.bat
/c
"cmd /c echo @file"
<br>
"t.bat"
<br>
"z.BAT"
<br>C:\Users\Administrator><br><
/span
>
1
<span style=
"font-size:16px;"
>C:\Users\Administrator>forfiles
/p
d:\
/m
*.txt
/c
"cmd /c del /q /f @file"
<br>C:\Users\Administrator><br><
/span
>
在例子中使用/Q 和 /F标签来作为删除命令。这意味着这个命令将使用安静模式(/Q)甚至删除只能读的文件(/F)。
1
<span style=
"font-size:16px;"
>C:\Users\Administrator>forfiles
/p
d:\forfiles
/s
/d
-7
/m
*.txt
/c
"cmd /c del @file /f"
<br>C:\Users\Administrator>forfiles
/p
d:\forfiles
/s
/d
-5
/m
*.txt
/c
"cmd /c del @path"
<br>C:\Users\Administrator><br><
/span
>
1
<span style=
"font-size:16px;"
>C:\Users\Administrator>forfiles
/p
d:\forfiles
/s
/m
*.*
/d
+2014
/12/15
/c
"cmd /c echo @file The last modified time is @fdate @ftime @fsize"
<br>
"bat1.bat"
The last modified
time
is 2014
/12/15
17:26:39 0<br>
"dir1_file2.txt"
The last modified
time
is 2014
/12/16
10:48:31 15<br>C:\Users\Administrator><br><
/span
>
1
<span style=
"font-size:16px;"
>@
echo
off<br>forfiles
/p
U:\%Date:~0,4%%Date:~5,2%%Date:~8,2%
/s
/m
XX.dbf
/c
"cmd /c echo @file @ftime"
<br>forfiles
/p
U:\%Date:~0,4%%Date:~5,2%%Date:~8,2%
/s
/m
PAR_QY_INFO%Date:~0,4%%Date:~5,2%%Date:~8,2%.dbf
/c
"cmd /c echo @file @ftime"
<br>forfiles
/p
U:\%Date:~0,4%%Date:~5,2%%Date:~8,2%
/s
/m
PAR_JTGPZF%Date:~0,4%%Date:~5,2%%Date:~8,2%.dbf
/c
"cmd /c echo @file @ftime"
<br>forfiles
/p
U:\%Date:~0,4%%Date:~5,2%%Date:~8,2%
/s
/m
PAR_PISTOCK_INFO%Date:~0,4%%Date:~5,2%%Date:~8,2%.dbf
/c
"cmd /c echo @file @ftime"
<br><
/span
>
1
<span style=
"font-size:16px;"
>@
echo
off<br>
echo
%Date:~0,4%年%
date
:~5,2%月%
date
:~8,2%日%Time:~0,2%:%
time
:~3,2%:%
time
:~6,2%<br>@
ping
-n 60 127.1>nul<br>
echo
%Date:~0,4%年%
date
:~5,2%月%
date
:~8,2%日%Time:~0,2%:%
time
:~3,2%:%
time
:~6,2%<br>pause<br><
/span
>
/v 显示所有不包含指定 string 的行。
/c 计算包含指定 string 的行并显示总数。
/n 将文件行号置于每行开头。
/i 指定搜索不区分大小写。
"string" 必需。指定要搜索的字符组。必须将 string 包含在引号之内(即,"string")。在用 find 命令指定的文件名或扩展名中不能使用通配符(* 和 ?)
[Drive:][Path] FileName 指定要在其中搜索指定字符串的文件的位置和名称。
/? 在命令提示符显示帮助。
1
2
3
4
@echo off
set
var
=我是值
echo %
var
%
pause
1
2
3
4
@echo off
set
/p
var
=请输入变量的值
echo %
var
%
pause
1
2
3
4
5
6
7
8
@
echo
off
set
/p
gw=请输入VPN网关:
route add 10.10.0.0 mask 255.255.0.0 %gw%
route add 10.17.0.0 mask 255.255.0.0 %gw%
route add 10.15.0.0 mask 255.255.0.0 %gw%
route add 192.168.0.0 mask 255.255.0.0 %gw%
route print
pause
0 0
- windows批处理基础练习(学习Ing)
- Windows基础学习笔记(批处理)
- HTML基础 学习ing
- windows bat批处理基础命令学习教程
- windows批处理学习笔记
- Windows批处理命令学习
- Windows批处理命令学习
- windows批处理学习
- 批处理命令基础学习
- dos批处理基础学习
- 批处理学习:基础语法
- linux基础学习笔记(持续更新ING)
- Windows批处理学习之批处理简单编程
- Windows批处理命令学习一
- Windows批处理命令学习二
- Windows批处理命令学习三
- Windows批处理命令学习二
- 学习ing
- leetcode 138. Copy List with Random Pointer
- Git常用命令
- 在命令行模式下查看Python帮助文档---dir、help、__doc__
- 使用nginx与nginx-rtmp-module搭建流媒体服务器
- spring-异构系统的数据兼容转换
- windows批处理基础练习(学习Ing)
- 合理利用零碎时间 你离成功必然更近一步!
- C++介绍-百度百科
- jackson流式解析
- input type=file accept属性上传文件很慢
- laraver migrate 生成数据库迁移、填充及字段修改
- 【Tomcat】mac下配置tomcat
- NS3 linux下编译出现unexpected indent错误
- 回文数及其判断(C++)