Convert an arguments-script into a stand-alone one?
Posted: 10 Oct 2013 09:31
Greetings everyone,
I was looking for a script to do some RegEx string searching and found the following one at:
- https://groups.google.com/forum/#!msg/a ... jasiLNBGUJ
but unfortunately the script only works using command-line arguments.
My aim here is to use the code in a stand-alone script where it doesn't rely on (external) command-line arguments, but simply reads a static value or from variables inside the FOR loop.
I've tried to do this myself by changing the FINDSTR values and related ones elsewhere in the script, but without luck (script didn't output anything anymore) =/
Hopefully someone here is willing to help me out.
Thanks a lot in advance!
Kind regards,
- ©opy[it]®ight
I was looking for a script to do some RegEx string searching and found the following one at:
- https://groups.google.com/forum/#!msg/a ... jasiLNBGUJ
Code: Select all
@echo off
set recurse=
if "%~1%~2"=="%~1" goto :EOF
if "%~3"=="" (set count=0 & %0 %1 %2 %2)
for /f "delims=" %%f in ('findstr /m "%~2" "%1"') do (
for /f %%a in ('type "%%f" ^| findstr "%~2"') do (
set /a count +=1
)
set recurse=%0 %1 "%~2.*%~3" "%~3"
)
%recurse%
echo %count%
but unfortunately the script only works using command-line arguments.
My aim here is to use the code in a stand-alone script where it doesn't rely on (external) command-line arguments, but simply reads a static value or from variables inside the FOR loop.
I've tried to do this myself by changing the FINDSTR values and related ones elsewhere in the script, but without luck (script didn't output anything anymore) =/
Hopefully someone here is willing to help me out.
Thanks a lot in advance!

Kind regards,
- ©opy[it]®ight