@echo off
setlocal EnableDelayedExpansion
rem---输入相关信息
@echo 姓名:%name%
set /p name=
@echo 部门:%department%
set /p department=
@echo 房间号码:%roomnumber%
set /p roomnumber=
@echo 显示器型号:%display%
set /p display=
@echo 备注:%other%
set /p other=
rem---生成文件,文件名称由输入信息组合而成
@echo > %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
rem---将输入信息写入新生成的文件
@echo 姓名: %name% >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
@echo 部门:%department% >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
@echo 显示器型号:%display% >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
@echo 房间号码:%roomnumber% >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
@echo 备注:%other% >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
rem---调用systeminfo命令,显示相关主机信息
@echo #######################################################
@echo #------------------【CPU】【内存】--------------------#
@echo #######################################################
@echo. >> %roomnumber%_%department%_%name%.txt
systeminfo >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
rem---统计磁盘空间信息
@echo #######################################################
@echo #--------------------【磁盘空间】---------------------#
@echo #######################################################
>>script.txt echo list disk
diskpart /s script.txt >> %roomnumber%_%department%_%name%.txt
del script.txt /q
@echo #********************【统计结束】*********************#
rem---将文件上传至Ftp服务器
echo >ftplog.txt
set FtpFile="%cd%"\ftplog.txt
echo open IP ADDRESS>>"%FtpFile%"
echo USERNAME>>"%FtpFile%"
echo PASSWORD>>"%FtpFile%"
echo cd ftp>>"%FtpFile%"
echo bin>>"%FtpFile%"
echo put %roomnumber%_%department%_%name%.txt>>"%FtpFile%"
echo bye>>"%FtpFile%"
start /wait ftp -v -i -s:"%FtpFile%"
del /q "%FtpFile%"
@echo #*******************【Ftp上传成功】********************#
@echo. >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
@echo. >> %roomnumber%_%department%_%name%.txt
pause