Humboldt-Universität zu Berlin - Historische Fachinformatik

test.bat

text/plain test.bat — 1.3 KB

Dateiinhalt

@echo off
set VBS=%temp%\%RANDOM%_temp.vbs

echo On Error Resume Next>> %VBS%
ECHO. >> %VBS%
ECHO. filename = "OSPP.VBS" >> %VBS%
ECHO. >> %VBS%
ECHO. Set objFSO = WScript.CreateObject("Scripting.FilesystemObject") >> %VBS%
ECHO. x=0 >> %VBS%
ECHO. For each drive in objFSO.drives >> %VBS%
ECHO. ProcFolders objFSO.GetFolder(drive.Driveletter ^&":\Program Files\Microsoft Office") >> %VBS%
ECHO. ProcFolders objFSO.GetFolder(drive.Driveletter ^&":\Program Files (x86)\Microsoft Office") >> %VBS%
ECHO. Next >> %VBS%
ECHO. >> %VBS%
ECHO. Sub ProcFolders(objFolder) >> %VBS%
ECHO.   if x=0 then >> %VBS%
ECHO.    For Each objFile In objFolder.Files >> %VBS%
ECHO.      If LCase(filename) = LCase(objFile.Name) Then >> %VBS%
ECHO.        pfad = objFile.Path >> %VBS%
ECHO. 	   WScript.Echo objFile.Path >> %VBS%
ECHO. 	   x=1 >> %VBS%
ECHO.      End If >> %VBS%
ECHO.    Next >> %VBS%
ECHO.   For Each objSubFolder In objFolder.SubFolders >> %VBS%
ECHO.     On Error Resume Next >> %VBS%
ECHO.     ProcFolders(objSubFolder) >> %VBS%
ECHO.     On Error Goto 0 >> %VBS%
ECHO.   Next >> %VBS%
ECHO.  End If >> %VBS%
ECHO. End Sub >> %VBS%

FOR /F "tokens=*" %%i IN ('CScript %VBS%') do (SET pfad=%%i)

CScript "%pfad%" /"SETHST:auskunft1.cms.hu-berlin.de"
CScript "%pfad%" /"act"