0%

Windows Batch

Basic

Batch Script Tutorial

Q&A

How to set a variable inside a loop for /F

Network

DNS

DNS刷新缓存

1
ipconfig /flushdns

Netstat

端口占用和杀死占用端口进程

1
2
3
4
5
6
7
8
# 端口占用
netstat -aon|findstr "80"

# 进程6604情况
tasklist|findstr "6604"

# 杀死进程
taskkill /T /F /PID 6604

File & Directory

磁盘使用

https://docs.microsoft.com/zh-cn/sysinternals/downloads/du

1
2
3
4
5
6
7
8
9
10
11
du.exe -h
usage: du [-c[t]] [-l <levels> | -n | -v] [-u] [-q] <directory>
-c Print output as CSV. Use -ct for tab delimiting.
Use -nobanner to suppress banner.
-l Specify subdirectory depth of information (default is one level).
-n Do not recurse.
-q Quiet.
-nobanner
Do not display the startup banner and copyright message.
-u Count each instance of a hardlinked file.
-v Show size (in KB) of all subdirectories.

Reference

Windows批处理(cmd/bat)常用命令教程