According to my previous question i found a solution for my problem.prev Question
I have written my script but i moved it to my server and i was surprised because the script does not working anymore. I made a new one only for testing and the solution from the previous question is not anymore workable!
Here is my test script
@echo off
TITLE MyBatch
SETLOCAL ENABLEDELAYEDEXPANSION
set "merger_list=C:\"
set "source=C:\ASAP2-Build\Input"
set "target=C:\ASAP2-Build\Output"
:loop
Rem this "for" loop executed for all folders in source path. /ad -> folder. /o:d -> sorted by date and time. /s -> include all subfolders. /b -> bare format
for /f %%i in ('dir %source% /ad /o:d /s /b') do (
rem command.merging is an empty file which works as a command. We use it to triger the merging function.
if exist %%i\command.merging (
rem a2lfiles_merger is a text file with a list, this list includes all the slave a2l files into a list to merging.
if exist %%i\a2lfiles_merger*.txt (
rem this loop have to find the complete name of the a2lfiles_merger. Will be f.ex. a2lfiles_merger2.txt
for /f "tokens=*" %%d in ('dir /b /s a2lfiles_merger*.txt') do (
set merger_list=%%d
echo !merger_list!
)
)
)
)
echo Folder is empty or does not exist
timeout /t 5
goto loop
The problem occurs when i call this line
for /f "tokens=*" %%d in ('dir /b /s a2lfiles_merger*.txt') do (
set merger_list=%%d
echo !merger_list!
)
The screen prints the message Das System kann die angegebene Datei nicht finden.
The translation is The system cannot find the file.
I have to explain why i need this code, in every folder there is always a txt file with an unknown name but always in form a2lfiles_merger*.txt
. Some folders have the file a2lfiles_merger2.txt
and others a2lfiles_merger3.txt
etc.
So it is so dificult to me to understand why this script runs at my computer and not at my server. The server has also windows 7. Have someone a suggestion ?