#1 16 Dec 2016 16:02

triopium
Member
Registered: 27 Nov 2016
Posts: 6

Get Setlocal level

Is there a native way to get current level of nesting when using Setlocal?

Offline

#2 17 Dec 2016 00:29

Aacini
Member
Registered: 05 Dec 2012
Posts: 116

Re: Get Setlocal level

No. There is not a native way to do that, although you can get such value in a very simple way just executing SET /A LEVEL+=1 after each Setlocal...

However, the real question here is this: why do you need this value?

Online

#3 20 Dec 2016 13:59

npocmaka
Member
From: Bulgaria
Registered: 03 Dec 2009
Posts: 421

Re: Get Setlocal level

Offline

#4 21 Dec 2016 00:10

triopium
Member
Registered: 27 Nov 2016
Posts: 6

Re: Get Setlocal level

Aacini wrote:

No. There is not a native way to do that, although you can get such value in a very simple way just executing SET /A LEVEL+=1 after each Setlocal...

However, the real question here is this: why do you need this value?

What I would like to get is rather complex task. Maybe it is wasted time. I would like to actually do some programming in CMD and batch, but I am constantly hiting wall because of weired special character escapeing mechanism. I know I can you "SET /A LEVEL+=1". I just asked if I can save some code lines and keep my script barebone minimal.

Offline

Board footer

Powered by FluxBB