DOS命令
新增用户:
@echo off
net user username "password" /add
pause
删除用户:
@echo off
net user username /del
pause
设置用户为管理员:
@echo off
net localgroup administrators username /add
pause
设置用户为非管理员:
@echo off
net localgroup administrators username /del
更改用户名:
@echo off
echo 当前用户名:%USERNAME%
set /p user=请输入要更改的用户名:
set /p newuser=请输入新的用户名称 :
wmic useraccount where name=‘%user%‘ call Rename %newuser%
pause
更改用户密码:
@echo off
net user username password
pause
清空用户密码:
@echo off
net user username ""
pause
注销系统:
@echo off
shutdown /l
定时关机:
@echo off
shutdown -s -t 300
取消定时设置:
@echo off
shutdown -a
重启系统:
@echo off
shutdown -r
查看本机系统进程:
@echo off
tasklist
pause
查看远程系统进程:
@echo off
tasklist /s ipaddress /u username /p password
pause
终止程序进程:
@echo off
taskkill /f /im "process name"
pause
7z压缩:
@echo off
7z a E:\archive.zip E:\*.txt
pause
7z解压缩:
@echo off
7z x E:\archive.zip -oE:\
pause
注:7-zip功能很强大,安装软件后,需要把安装目录下的7z.exe以及7z.dll文件copy到C:\Windows\System32目录下;
新建文件夹:
@echo off
set nginxbackupdir=D:\backup\nginx
md %nginxbackupdir%\%date:-=%
md D:\backup\folder
pause
删除文件夹:
@echo off
rd /s /q D:\backup\folder
pause
备份资料:
@echo off
xcopy /y /s /e d:\mysql d:\backup\mysql
pause
本文出自 “方寸小山” 博客,请务必保留此出处http://63638790.blog.51cto.com/513514/1672750
原文地址:http://63638790.blog.51cto.com/513514/1672750