Software inventarisatie batch file Win9x


Batchfile voor Win9x om automatisch alle filenamen met gewenste extenties die op een computer staan te verzamelen en naar een textfile te schrijven.

@ECHO OFF

:: dit bat-file maakt een file aan waarin alle filenamen in staan die op de

:: schijven van een computer staan gesorteerd op extentie en incl. padnaam

:: datum & tijd in variabelen zetten

:: Written by Ad Slijkerman with thanks for date&time  and usrinput routines to Rob van der Woude

:: Set environment variables with currend Date, Time and DayOfWeek

:: Recursion

IF NOT "%3"=="" GOTO SecondTime

:: Create temporary batch file

> TEMPDTT1.BAT ECHO @PROMPT %0 $D $T

:: Do _N_O_T_ replace "COMMAND /C" with CALL in the next line

> TEMPDTT2.BAT COMMAND /C TEMPDTT1.BAT

TEMPDTT2

:SecondTime

DEL TEMPDTT?.BAT

SET DOW=%1

SET DATE=%2

SET TIME=%3

:: remove forward slashes from DATE variable and store result in DATE2

IF EXIST DATE2.BAT DEL DATE2.BAT

SET DATE2=

:: Parse DATE variable and create temporary batch

:: file to recreate DATE without forward slashes

>> DATE2.BAT FOR %%A IN (/%DATE%) DO ECHO SET DATE2=%%DATE2%%%%A

CALL DATE2.BAT

DEL DATE2.BAT

:: ---------------------------------------------------------------------

@ECHO OFF

REM * Asks for USeR INPut and store it in variable USRINPUT

REM * Uses ANSI if available, but works without ANSI too

REM * Assumes MS-DOS 6 or later

SET USRINPUT=

REM * Check if ANSI sequences can be used (needs at

REM * least MS-DOS 6 to get an errorlevel from FIND):

SET ANSI=1

MEM /C | FIND "ANSI" > NUL

IF ERRORLEVEL 1 SET ANSI=0

REM * Turn on ANSI key translation (translate Enter

REM * key to F6 + Enter sequence) if possible:

IF "%ANSI%"=="1" ECHO 

REM * Ask for input:

IF "%ANSI%"=="0" ECHO Enter one word only, and press F6 followed by Enter . . .

IF "%ANSI%"=="1" ECHO Enter one word only, and press Enter . . .

REM * Copy entered text to temporary file:

COPY CON %TEMP%.\~USRINP.TMP

REM * Turn off ANSI key translation and clear irrelevant screen output:

IF "%ANSI%"=="0" CLS

IF "%ANSI%"=="1" ECHO 

REM * Add empty line to temporary file. The empty line

REM * will be used to stop DATE asking for new date.

ECHO.>> %TEMP%.\~USRINP.TMP

ECHO.>> %TEMP%.\~USRINP.TMP

REM * Create a temporary batch file that will store the

REM * entered text into the environment variable USRINPUT:

TYPE %TEMP%.\~USRINP.TMP | DATE | FIND "):" > %TEMP%.\~USRINP.BAT

REM * Create more temporary batch files. Add

REM * more command line parameters if necessary,

REM * as in: ECHO SET USRINPUT=%%3 %%4 %%5 %%6 %%7 %%8 %%9>CURRENT.BAT

ECHO SET USRINPUT=%%3>CURRENT.BAT

REM * VOER.BAT and TYP.BAT are replacements for CURRENT.BAT for Dutch

REM * DOS versions; add your own language versions if necessary:

ECHO SET USRINPUT=%%6>VOER.BAT

ECHO SET USRINPUT=%%4>TYP.BAT

REM * This temporary batch file now sets the variable USRINPUT:

CALL %TEMP%.\~USRINP.BAT

REM * Display the result:

IF "%ANSI%"=="0" ECHO You typed: %USRINPUT%

IF "%ANSI%"=="1" ECHO You typed: %USRINPUT%

REM * Finally, clean up the mess of temporary files:

FOR %%A IN (%TEMP%.\~USRINP.BAT %TEMP%.\~USRINP.TMP VOER.BAT TYP.BAT CURRENT.BAT) DO DEL %%A

SET ANSI=

:: ---------------------------------------------------------------------

:: machine software inventarisatie maken

:: als een extentie helemaal niet voorkomt komt er een error

:: op het scherm helaas kan dit niet anders

:: machinenaam in variabele zetten

::set inventfile=softw_invent_exe_%USRINPUT%_%date%.txt

set inventfile=softw_invent_%USRINPUT%_%date%.txt

:: file aanmaken en basisgegevens hierin opslaan

echo %DATE% %TIME% %username% %USRINPUT% > %inventfile%

:: dir commando voor .exe files

dir c:\*.exe /s /v >> %inventfile%

dir d:\*.exe /s >> %inventfile%

:: dir e:\*.exe /s >> %inventfile%

:: dir f:\*.exe /s >> %inventfile%

:: dir g:\*.exe /s >> %inventfile%

:: dir h:\*.exe /s >> %inventfile%

:: dir commando voor .com files

:: set inventfile=softw_invent_com_%USRINPUT%_%date%.txt

dir c:\*.com /s >> %inventfile%

dir d:\*.com /s >> %inventfile%

:: dir e:\*.com /s >> %inventfile%

:: dir f:\*.com /s >> %inventfile%

:: dir g:\*.com /s >> %inventfile%

:: dir h:\*.com /s >> %inventfile%

:: dir commando voor .bat files

:: set inventfile=softw_invent_bat_%USRINPUT%_%date%.txt

dir c:\*.bat /s >> %inventfile%

dir d:\*.bat /s >> %inventfile%

:: dir e:\*.bat /s >> %inventfile%

:: dir f:\*.bat /s >> %inventfile%

:: dir g:\*.bat /s >> %inventfile%

:: dir h:\*.bat /s >> %inventfile%

:: dir commando voor .bas basic files

:: set inventfile=softw_invent_bas_%USRINPUT%_%date%.txt

dir c:\*.bas /s >> %inventfile%

dir d:\*.bas /s >> %inventfile%

:: dir e:\*.bas /s >> %inventfile%

:: dir f:\*.bas /s >> %inventfile%

:: dir g:\*.bas /s >> %inventfile%

:: dir h:\*.bas /s >> %inventfile%

:: dir commando voor .dll files

:: set inventfile=softw_invent_dll_%USRINPUT%_%date%.txt

dir c:\*.dll /s >> %inventfile%

dir d:\*.dll /s >> %inventfile%

:: dir e:\*.dll /s >> %inventfile%

:: dir f:\*.dll /s >> %inventfile%

:: dir g:\*.dll /s >> %inventfile%

:: dir h:\*.dll /s >> %inventfile%

:: dir commando voor .inf files

:: set inventfile=softw_invent_inf_%USRINPUT%_%date%.txt

dir c:\*.inf /s >> %inventfile%

dir d:\*.inf /s >> %inventfile%

:: dir e:\*.inf /s >> %inventfile%

:: dir f:\*.inf /s >> %inventfile%

:: dir g:\*.inf /s >> %inventfile%

:: dir h:\*.inf /s >> %inventfile%

:: dir commando voor .ini files

:: set inventfile=softw_invent_ini_%USRINPUT%_%date%.txt

dir c:\*.ini /s >> %inventfile%

dir d:\*.ini /s >> %inventfile%

:: dir e:\*.ini /s >> %inventfile%

:: dir f:\*.ini /s >> %inventfile%

:: dir g:\*.ini /s >> %inventfile%

:: dir h:\*.ini /s >> %inventfile%

:: dir commando voor .sys files

:: set inventfile=softw_invent_sys_%USRINPUT%_%date%.txt

dir c:\*.sys /s >> %inventfile%

dir d:\*.sys /s >> %inventfile%

:: dir e:\*.sys /s >> %inventfile%

:: dir f:\*.sys /s >> %inventfile%

:: dir g:\*.sys /s >> %inventfile%

:: dir h:\*.sys /s >> %inventfile%

:: dir commando voor .scp script files

:: set inventfile=softw_invent_scp_%USRINPUT%_%date%.txt

dir c:\*.scp /s >> %inventfile%

dir d:\*.scp /s >> %inventfile%

:: dir e:\*.scp /s >> %inventfile%

:: dir f:\*.scp /s >> %inventfile%

:: dir g:\*.scp /s >> %inventfile%

:: dir h:\*.scp /s >> %inventfile%

:: dir commando voor .js javascript files

:: set inventfile=softw_invent_js_%USRINPUT%_%date%.txt

dir c:\*.js /s >> %inventfile%

dir d:\*.js /s >> %inventfile%

:: dir e:\*.js /s >> %inventfile%

:: dir f:\*.js /s >> %inventfile%

:: dir g:\*.js /s >> %inventfile%

:: dir h:\*.js /s >> %inventfile%

:: dir commando voor .vbs visual basic script files

:: set inventfile=softw_invent_vbs_%USRINPUT%_%date%.txt

dir c:\*.vbs /s >> %inventfile%

dir d:\*.vbs /s >> %inventfile%

:: dir e:\*.vbs /s >> %inventfile%

:: dir f:\*.vbs /s >> %inventfile%

:: dir g:\*.vbs /s >> %inventfile%

:: dir h:\*.vbs /s >> %inventfile%

:: dir commando voor .dat registry files

:: set inventfile=softw_invent_dat_%USRINPUT%_%date%.txt

dir c:\*.dat /s >> %inventfile%

dir d:\*.dat /s >> %inventfile%

:: dir e:\*.dat /s >> %inventfile%

:: dir f:\*.dat /s >> %inventfile%

:: dir g:\*.dat /s >> %inventfile%

:: dir h:\*.dat /s >> %inventfile%


Reacties & suggesties : adjes@startmail.nl


Ad Slijkerman.
Copyright © 2002  Alle rechten voorbehouden.