gibt es eine möglichkeit das Ergebiss einer .log Datei weiter zu Verarbeiten ?
Hintergedanke des ganzen ist, das die Batch eine bestimmte Datei sucht und diese dann in ein anderes Verzeichniss ablegt.
Die Suche und Protokollierung funktioniert soweit.
Jetzt hängt es an der weiterverarbeitung !
@echo off & setlocal :: Set variable for InputBox: set myMessage=Bitte BA-Nummer eingeben ! set myTitle=Tool für Auftragsdaten call :subInputBox :: Display variable if "%flag%"=="false" ( set myMessage=Vorgang abgebrochen. set myTitle=Vorgang abgebrochen call :subMsgBox ) else ( set %cmdText% ) goto Search :: Start subroutine subInputBox :subInputBox set VBS="%Temp%\vbsInputBox.vbs" set CMD="%Temp%\cmdVar.bat" >> %VBS% echo Option Explicit >> %VBS% echo Dim strText >> %VBS% echo Dim objShell : Set objShell = CreateObject("Wscript.Shell") >> %VBS% echo Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject") >> %VBS% echo Dim objFile : Set objFile = objFSO.CreateTextFile(%CMD%) :: Pass variable from batch to VBScript >> %VBS% echo strText = InputBox("%myMessage%", "%myTitle%") >> %VBS% echo if strText = vbNullString then :: Create batch file >> %VBS% echo objFile.WriteLine "@echo off" >> %VBS% echo objFile.WriteLine "set flag=false" >> %VBS% echo else >> %VBS% echo objFile.WriteLine "@echo off" :: Set variable in batch file >> %VBS% echo objFile.WriteLine "set cmdText=" ^& strText >> %VBS% echo end if >> %VBS% echo objFile.Close cscript %VBS% > NUL call %CMD% > NUL del %CMD% del %VBS% goto :EOF :: End subroutine subInputBox :: Start subroutine subMsgBox :subMsgBox >> %Temp%\MsgBox.vbs echo MsgBox "%myMessage%", VbInformation + VbOKOnly, "%myTitle%" cscript %Temp%\MsgBox.vbs > NUL del %Temp%\MsgBox.vbs goto :EOF :: End of subroutine subMsgBox :Search set "SrcDir=J:\Produktiv\Public\Auftraege\Eingang" set "FileType=txt" set "SearchKey=%cmdText%" set "LogFile=Protokoll.log" REM Das Ergebniss steht in der .log Datei (for %%f in ("%SrcDir%\*.%FileType%") do ( type "%%~f" | findstr /c:"%SearchKey%" > NUL && ( echo %%~f ) )) > "%LogFile%"