windows添加自定义服务
查看计算机名hostname
查看当前路径chdir
查看当前用户名和域名
netstat 查看特定ip tcp/ip活动
tracert 跟踪路由信息
net 网络命令中最重要的一个
at安排在特定日期或时间执行某个特定的命令和程序
ftp命令网络上开放ftp的主机
特定用户运行命令(应用网络位置)
runas /user:administrator "cmd /k"
net use i: \\192.168.0.99\public #将\\192.168.0.99\public目录建立为I盘
net use i: \\192.168.0.99\public /delete #断开连接
net use i: \\10.5.241.112\C$映射远程C盘到本地
局域网内端口映射
netsh interface portproxy add v4tov4 listenaddress=192.168.1.131 listenport=8661 connectaddress=192.168.99.100 connectport=8660 protocol=tcp
dos远程连接 windows
net use \\10.5.241.112\ipc$ "Byzl!234"
net user Administrator "Byzl!234" /add
激活用户net user Administrator /active:no/yes
sc create wuziServer binPath= D:\wuzi\wuzi-start.bat start= auto
net view主要是查看远程主机所有共享资源
注册ocx文件方法regsvr32 C:\Windows\SysWOW64\HWPenSign.ocx
Bat 内容
@echo off
rem
rem Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
rem Use is subject to license terms.
rem
call D:\wuzi\glassfish4\glassfish\bin\asadmin start-domain domain1
pause
查看端口占用tasklist |findstr "9000"
netstat -ano|findstr "9000"
杀死进程
taskkill /f /t /im Tencentdl.exe
tasklist|findstr 进程号
netstat -aon|findstr "80"
tasklist|findstr "2448"
taskkill -f -t -im 文件名
taskkill /im 文件名
taskkill /pid[进程码] -t(结束该进程) -f(强制结束该进程以及所有子进程)
wmic process where name="进程名称" call terminate
ntsd -c q -p [pid进程码]
强制删除粉碎文件
DEL /F /A /Q \\?\%1
RD /S /Q \\?\%1
拖动文件到bat
删除一个文件夹的命令
del /F /A /Q dir
全盘搜索删除
@echo off
for /f "skip=1" %%c in ('wmic logicaldisk where "drivetype=3" get name') do del /f /s /q /a "%%c\info.db"
echo
resmon dos打开资源管理器
openfiles /local on
openfiles.exe /disconnect [/s Computer [/u Domain\User [/p Password]]] {[/id OpenFileID]|[/a UserName]|[/o OpenMode]} [/se SessionName] [/op OpenFileName]
自动部署文件备份
set NOW_TIME=%date:~0,4%%date:~5,2%-%date:~8,2%-%time:~0,2%%time:~3,2%%time:~6,2%
echo NOW_TIME
cd C:\Users\sxshe\Desktop
ren new.docx %NOW_TIME%.docx
move C:\Users\sxshe\Desktop\new.docx C:\Users\sxshe\Desktop\%NOW_TIME%.docx
pause
*所有子文件夹里的文件全部提取出来,放到A文件夹里面
for /f "delims=" %a in ('dir /b/s/a-d') do move /-y "%a" "%~dp0%~nxa"
*所有后缀为*.java2的文件名为*.java
for /f "delims=" %a in ('dir /b/s/a-d *.java2') do rename "%a" *.java
*文件夹下所有后缀为*.txt的文件到目录F:\file中
for /f "delims=" %a in ('dir /b/s/a-d *.txt) do copy "%a" F:\file
判断文件文件夹存在
if exist "C:\Users\sxshe\Desktop\2019.docx" (start "cd" "C:\Users\sxshe\Desktop\")
@echo off
:loop
if exist "C:\Program Files\BB" (start "" "C:\Program Files\BB.EXE"&&exit)
Ping -n 5 127.1>nul
Goto loop
pause
@echo off不显示命令行
@echo on显示命令行
设置提示信息根据用户判断执行
set passwd=
set /p passwd=请输入密码:
if /i %passwd%==123456 goto start
echo 密码错误!任意键退出...
pause>nul
exit
:start
move c:\progra~1\a\* d:\2\
echo 执行完毕,任意键退出...
pause>nul
exit
循环
set "a=abc def ghi"
for %%i in (%a%) do echo %%i
pause
查看目录下包含【googleapis】字符串的所有文件
findstr /s /i “googleapis” *.*
执行jar文件
java -Dfile.encoding=UTF-8 -jar MainNcTimer.jar
copy c:\ c:\1
xcopy c:\ c:\1 /s递归复制
递归移动
@echo off
set src=D:\ywzs
set dest=E:\
set temp=E:\
dir %src% /s /b /o-d > "%temp%\mymove.txt"
for /f "skip=1" %%i in (%temp%\mymove.txt) do move /y "%%i" "%dest%"
pause
启动应用程序脚本(start.vbs)
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run Chr(34) & "C:\Users\sxshe\Desktop\connectWifi.bat" &Chr(34), 0
Set WshShell = Nothing
bat启动应用
@echo off
:View
"C:\xx\vmware-view.exe"
shutdown -s -t 0
快捷打开命令框
1.在文件夹区域右键-在此处打开命令框
2.在文件夹路径框输入cmd
设置时间同步
net start w32time
w32tm /resync
w32tm /config /manualpeerlist:"time.windows.com" /syncfromflags:manual /reliable:yes /update
w32tm /register
w32tm /unregister
w32tm /query /configuration
w32tm /query /source
w32tm /tz
w32tm /stripchart /computer:13.89.46.24 /samples:30 /dataonly
连接winscp脚本
winscp.exe /console /command "option batch continue" "option confirm off" "open sftp://yy:yy@ip:port" "option transfer binary" "get /xx/xx/%x% x:\" "exit" /"log=x:\xxx.txt"