@echo off
REM The above statement needs disable to show more
rem !!!!!!!!!!!!!!!!!!!!!DO NOT CHANGE THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
rem Root path of file being processed
set rootpath=%1
rem Device name(drive letter) of the file path
set devicename=%rootpath:~1,2%
rem Change active directory to c drive, d drive etc
%devicename%
rem Extract path to /Scripts folder from File path
set scriptdir=%rootpath:~1,-13%\\scripts
cd "%scriptdir%"
rem !!!!!!!!!!!!!!!!!!!!!END OF DO NOT CHANGE THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!
set prg=%0
set pth=%1
set exp=%2
set grp=%3
set sub=%4
set con=%5
set trl=%6
set frq=%7
set res=%8
rem These are all arguments. There is no Argument9: %9
rem *****************************END SETTINGS**********************************
Rem Strip initial zero in %trl%
set /a trlsearch=%trl%
set trlshow=2
set seg=2
set col=4
REM Show input arguments and calculated arguments
REM Program=%0
REM Datapath=%pth%
REM Experiment=%exp%
REM Group=%grp%
REM Subject%sub%
REM Condition=%con%
REM Trial=%trl%
REM SamplingFrequency=%frq%
REM Resolution=%res%
REM TrialSearch=%trlsearch%
REM TrialShow=%trlshow%
REM Segment=%seg%
REM Column=%col%
echo Show KR when trialsearch=%trlsearch% equals triallshow=%trlshow%
if "%trlsearch%"=="%trlshow%" goto showkr
goto end
:showkr
echo.
echo. KR consists of specific lines and columns of the EXT file
echo ________________________________________
rem Show Columns 1, 2, %col% of Line 1 and the Line starting with %trlsearch% %seg%
awk "{if(NR==1)print $1,$2,$%col%}/^%trlsearch% %seg%/{print $1,$2,$%col%}" %pth%\%exp%%grp%%sub%%con%.ext
echo ________________________________________
echo.
WaitASecond.exe
echo waited 1 second
WaitASecond.exe
echo waited 1 second
WaitASecond.exe
echo waited 1 second
:end
IF %ERRORLEVEL% NEQ 0 echo %ERRORLEVEL%
IF %ERRORLEVEL% NEQ 0 pause
echo.
echo Pause to show what this procedure is doing
echo If you let the procedure wait more than a few seconds
echo it will ask you whether you wish to continue waiting.
echo Click No.
echo.
pause