Reads commands from an external file
Posted: 16 Aug 2011 13:31
Hi guy's,
I work an a project and I have some problems to load commands from a file (drag/drop) like that:
example_cmd_file.bat
my_script_to_read_the_file.bat
Some ideas?
Thanks.
I work an a project and I have some problems to load commands from a file (drag/drop) like that:
example_cmd_file.bat
Code: Select all
@echo off
start calc.exe
pause
my_script_to_read_the_file.bat
Code: Select all
@echo off
setlocal enabledelayedexpansion
set linz=0 & for /F "tokens=* delims=" %%b in ('type %~1') do set /a linz+=1
echo ^>^>^> Debug:^> Lines^= !linz!
< "%~1" (
for /L %%c in (1,1,!linz!) do (
set /p line%%c=
)
)
for /L %%w in (1,1,!linz!) do (
!line%%w!
)
pause
Some ideas?
Thanks.