How to increase Recursion Count of the Stack in a batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
hacker
Posts: 6
Joined: 29 Aug 2014 06:21

How to increase Recursion Count of the Stack in a batch file

#1 Post by hacker » 22 Sep 2014 08:49

Hi

****** B A T C H R E C U R S I O N exceeds STACK limits ******
Recursion Count=704, Stack Usage=90 percent
****** B A T C H PROCESSING IS A B O R T E D ******


How can increase Recursive Count of the Stack in a batch file?

Please Guide me in this regard.
Thanks in advance

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: How to increase Recursion Count of the Stack in a batch

#2 Post by Squashman » 22 Sep 2014 08:51

Dave has a good explanation of this over on SO.
http://stackoverflow.com/a/11917798/1417694

You may want to post your batch file.

jeb
Expert
Posts: 1055
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

Re: How to increase Recursion Count of the Stack in a batch

#3 Post by jeb » 22 Sep 2014 09:31

Hi hacker,

you can't really expand the limit and the limit also depends of the windows version.

But you can change your recursion to an iteration, this will work as batch seems to be able to handle unlimited variables.
And I suppose it should be faster, as CALLs to functions are very slow.

You could post your code, so we are able to look for optimizations.

ravikarthik
Posts: 1
Joined: 30 Mar 2018 09:38

Re: How to increase Recursion Count of the Stack in a batch file

#4 Post by ravikarthik » 30 Mar 2018 09:45

HI Team,
iam trying to convert the Tab delimited csv file into comma delimited csv file.Iam using the below code to do that.But i am getting the error as Batch recursion exceeds stock limits.

I have created batch file with the below script.

call jrepl "\t" "," /x /f "E:\Eapps\TEST1.csv" /o "E:\Eapps\TEST.csv"

Can anyone please help me here.

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: How to increase Recursion Count of the Stack in a batch file

#5 Post by ShadowThief » 30 Mar 2018 18:34

It should be as simple as

Code: Select all

@echo off
setlocal enabledelayedexpansion

for /f "delims=" %%A in (test1.csv) do (
	set "tab_line=%%A"
	set "comma_line=!tab_line:	=,!"
	echo !comma_line! >>test.csv
)

Compo
Posts: 600
Joined: 21 Mar 2014 08:50

Re: How to increase Recursion Count of the Stack in a batch file

#6 Post by Compo » 31 Mar 2018 04:34

Why not use the built in PowerShell CSV functionality:

Code: Select all

Import-Csv 'E:\Eapps\TEST1.csv' -Delimiter `t | Export-Csv 'E:\Eapps\TEST1.csv' -NoTypeInformation

Rollon
Posts: 1
Joined: 27 Mar 2018 03:37

Re: How to increase Recursion Count of the Stack in a batch file

#7 Post by Rollon » 07 Apr 2018 00:58

jeb wrote:
22 Sep 2014 09:31
Hi hacker,

you test link can't really expand the limit and the limit also depends of the windows version.

But you can change your recursion to an iteration, this will work as batch seems to be able to handle unlimited variables.
And I suppose it should be faster, as CALLs to functions are very slow.

You could post your code, so we are able to look for optimizations.
Does this work well? It looks simple and straightforward.
Last edited by Rollon on 24 Jun 2022 00:22, edited 1 time in total.

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: How to increase Recursion Count of the Stack in a batch file

#8 Post by dbenham » 07 Apr 2018 09:35

ravikarthik wrote:
30 Mar 2018 09:45
But i am getting the error as Batch recursion exceeds stock limits.

I have created batch file with the below script.

call jrepl "\t" "," /x /f "E:\Eapps\TEST1.csv" /o "E:\Eapps\TEST.csv"

Can anyone please help me here.
JREPL.BAT alone cannot give you a recursion stack error. Either you have a corrupt version of JREPL.BAT, or the error has nothing to do with JREPL and there is more code that you are not showing.

The JREPL command you have shown should work fine, although the /X option is not needed.


Dave Benham

Post Reply