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
Thread Forum
.exe files running problem
all my .exe files are getting opened with utorrent. tried to fix it with .reg file but that didn't help at all. now i cant download, cant install anything .unable to run any .exe programs.:cry: how can i fix this?
General Discussion
64-bit not running batch files/Path environment
Greetings to all fellow Win 7ers (this is my first post...) I recently got a new laptop running Win 7 Pro 64-bit and as part of my initial third-party software installations I inadvertently overwrote the 'Path' environment variable (instead of appending to it). I subsequently tried adding...
General Discussion
problem: running srt,sub with mkv files
hi i have hp laptop with windowd 7 in the beginning my MC wasn't able to play mkv files until i installed win7codecs pack and x64components pack. the problem is my subtitles don't show up with the video in MC. I can run my Subtitles with WMP and Real player but i can't run it with MC
Media Center
problem with running .reg files
When I run .reg files I choose to run them as administrator. I get an information saying that the information was succesfully added to the registry. However, when I open the registry I see that those keys weren't added at all. What's wrong?
General Discussion
Windows 7 problem after finishing install
Hello there, Ive been having a problem installing Windows 7. I have a Gateway P6860 FX, Windows Vista Home Premium 64x, that has its own RECOVERY Partition. The thing is, when I try to upgrade from Vista it tells me I cannot upgrade from 32 to 64x (although I have a 64x Vista) so I proceed to...
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 04:50.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App