Wednesday, February 25, 2015

BATCH(.bat) SCRIPT(window)

PART1 SIMPLE

(1)CREATE FOLDER

set /P id=Enter id:
mkdir %id%

(2) FOLDER NAME WITH DATE
for /F "tokens=1-4 delims=/ " %%A in ('date/t') do (
set DateDay=%%A
set DateMonth=%%B
set DateYear=%%C
)

set CurrentDate=%DateMonth%-%DateDay%-%DateYear%

mkdir %CurrentDate% 

(3) PING 
@echo off
set /p a="Enter IP Address or Name: "
ping %a%
pause

(4)


PART2 Mixed function script
(1) user enter Devices name and IP address

@echo off
for /F "tokens=1-4 delims=/ " %%A in ('date/t') do (
set DateDay=%%A
set DateMonth=%%B
set DateYear=%%C
)


set CurrentDate=%DateDay%-%DateMonth%-%DateYear%
set /P name=Enter name of folder:
set /p bmc_ip="Enter BMC IP Address: "


mkdir %CurrentDate%_%name%

@echo on
ipmitool -I lan -H %bmc_ip% -U USERID -P PASSW0RD sensor >  %CurrentDate%_%name%/SENSOR.TXT
ipmitool -I lan -H %bmc_ip% -U USERID -P PASSW0RD sel list >  %CurrentDate%_%name%/list.TXT
ipmitool -I lan -H %bmc_ip% -U USERID -P PASSW0RD sel elist > %CurrentDate%_%name%/elist.TXT


output:
Enter name of folder: DUT1-1
Enter BMC IP Address: 192.168.1.2

No comments:

Post a Comment