Has anyone any familiarity with calling batch files from C?
I want to call a batch file from a C programme and pass one parameter from the C to the batch.
The system call in the C programme is
system("testing_parse_lines_DOS-2.bat oldrptname");
with the parameter being oldrptname. Note that oldrptname is a variable and contains data which will be different every time the C programme is run.
The batch file is
@echo off
setlocal enabledelayedexpansion
for /f "tokens=1,2,3,4* delims=\" %%a in (moveTIFF.dat) do (
set full_line=\%%a\%%b\%%c\%%d
set file_name=%%d
echo Full line: !full_line!
echo File name: !file_name!
echo.
copy /b !file_name! !full_line!
)
del RPT.dat
del moveTiff.dat
rename error.dat %1
and the parameter passed is %1.
The problem is that the renaming works up to a point. It changes the file name 'error.dat' to 'oldrptname' rather than the contents of the variable oldrptname. The data in oldrptname will always have the form "xxxxxxxx.RPT".
I am hoping that the error is a simple syntax error.