Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Cmd Batch Files Running Without Finishing: Recursion problem??


30 Sep 2012   #1
mavigozler

Windows 7 Home Premium 64-bit
 
 
Cmd Batch Files Running Without Finishing: Recursion problem??

I have a very simple batch set in a file called sed.cmd.

Code:
set input="D:\WebServerConfig\httpd\logs\old logs\webserver-access.log"
set output="D:\WebServerConfig\httpd\logs\old logs\webserver-access-trimmed.log"
set script=D:\WebServerConfig\httpd\logs\delete-needless-webserver-access-log-lines.sed
sed -r -u -f %script% %input% >%output
It just runs without exiting.

When I don't re-direct output, meaning output goes to stdout (the command window), meaning I just have the edited cmd file as:

Code:
set input="D:\WebServerConfig\httpd\logs\old logs\webserver-access.log"
set output="D:\WebServerConfig\httpd\logs\old logs\webserver-access-trimmed.log"
set script=D:\WebServerConfig\httpd\logs\delete-needless-webserver-access-log-lines.sed
sed -r -u -f %script% %input%
It runs without exiting, but now I can see what is happening through the standard output: I just see each of the batch command lines output in a never-ending continuing cycle.

When I try to terminate with Ctrl-C, I keep seeing "Terminate batch job (Y/N)?" as I continue to enter "Y". When I close the cmd window forciby, I see a whole bunch of ^C characters output before the window is closed, suggesting some sort of recursion was happening...but why?


My System SpecsSystem Spec
.

30 Sep 2012   #2
UsernameIssues

W7 Pro SP1 64bit
 
 

you named the batch file SED and then you call SED from within the batch file...

it is calling itself over and over
My System SpecsSystem Spec
30 Sep 2012   #3
mavigozler

Windows 7 Home Premium 64-bit
 
 

Quote   Quote: Originally Posted by UsernameIssues View Post
you named the batch file SED and then you call SED from within the batch file...

it is calling itself over and over
LOL!

Okay. yes

I changed to the last line in the batch file to

sed.exe -r -u ...

and problem solved.

Pretty rookie mistake.
My System SpecsSystem Spec
.


30 Sep 2012   #4
UsernameIssues

W7 Pro SP1 64bit
 
 

:-)
My System SpecsSystem Spec
Reply

 Cmd Batch Files Running Without Finishing: Recursion problem??




Thread Tools



Similar help and support threads for2: Cmd Batch Files Running Without Finishing: Recursion problem??
Thread Forum
.exe files running problem General Discussion
Solved Problem running some .exe and .bat files General Discussion
64-bit not running batch files/Path environment General Discussion
problem: running srt,sub with mkv files Media Center
problem with running .reg files General Discussion
Windows 7 problem after finishing install Installation & Setup

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 11:16 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App