Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Is there a way to maintain the position in the environment list, while debugging?

Oct
23
0
Hi,

I'm trying to tweak the attached batch file, to work inside the IDE. It works fine, on an ordinary command line outside the IDE.

But the inconvenience I'm experiencing, is that the list of environmental variables keeps scrolling up.

Most of the variables I'm trying to observe - like v_dd, and v_mm, are at the bottom of the list of variables. So it's necessary to scroll down to see them. But every time I single step through the batch, it resets the pointer to the top of the list of variables.

So I have to keep scrolling down, for each single step.

Aside from setting WATCHes, is there a way around this?
 
Last edited:
It still won't attach. I don't know what's going on.

I did resolve most of the main problem, that the final variables were blank.

The last lines were

:s_end_days
ENDLOCAL&SET /a _yy_int=%v_yy_int%&SET /a _mm_int=%v_mm_int%&SET /a _dd_int=%v_dd_int%&SET _ymd_str=%v_ymd_str%&SET _mm_str=%v_mm_str%&SET _dd_str=%v_dd_str%

, and the variables were returning blank. So I inserted spaces before & after the amperscands &. Now, of course, some of the variables have trailing spaces. But that's easily fixed.


So, my main question is how to keep the pointer to the list of environment variables stable. So if we're pointing to the very last environment variable, and we single step, I'd like the pointer to remain at the bottom. Problem is, it keeps resetting to the top.
 
@TCFan how about adding .TXT to the end of the .BAT then try to upload. Failing that - - why not post to Onedrive then post the link....
 
The batch file itself, is no longer relevant, since it iseems to be working now.

The problem is the list of environmental variables, in the ide. I just want to retain the position, after each step through the code. But the IDE keeps scrolling the variable list back to the top.

No luck, on the text attachment. But the original is here, before I edited that last line:



Again, I'm not asking for assistance on the batch file. Not at this point, Just on how to retain the current pointer, to the specific relevant environment variables, without using Watches.
 
Im pretty sure its alphabetically stored, so change your variables too; a_dd b_vv after you've found what your looking for swap them back
 
@TCFan How about changing each "&" to newlines? So the last few lines is:

Code:
    ECHO [%v_ymd_str%] YY=[%v_yy_int%] MM=[%v_mm_str%] DD=[%v_dd_str%]
    ECHO ~~~~~~~~~~~~
    :s_end_days
ENDLOCAL
SET /a _yy_int=%v_yy_int%
SET /a _mm_int=%v_mm_int%
SET /a _dd_int=%v_dd_int%
SET _ymd_str=%v_ymd_str%
SET _mm_str=%v_mm_str%
SET _dd_str=%v_dd_str%
 
@TCFan How about changing each "&" to newlines? So the last few lines is:

Code:
    ECHO [%v_ymd_str%] YY=[%v_yy_int%] MM=[%v_mm_str%] DD=[%v_dd_str%]
    ECHO ~~~~~~~~~~~~
    :s_end_days
ENDLOCAL
SET /a _yy_int=%v_yy_int%
SET /a _mm_int=%v_mm_int%
SET /a _dd_int=%v_dd_int%
SET _ymd_str=%v_ymd_str%
SET _mm_str=%v_mm_str%
SET _dd_str=%v_dd_str%
I believe the writer did it for this reason, that the variables on the same line as the ENDLOCAL, can inherit the values of the Local variables (which would ordinarily be cleared), into the parent scope.


From Windows NT Shell Scripting, by Tim Hill:

***
This trick of assigning a variable with its own value on the same line as the
ENDLOCAL command allows a variable's value to "tunnel" through a local scope.
It can be used for multiple return values. For example:

endlocal & set RET=%RET% & set SRCDIR=%SRCDIR%

This example tunnels the RET and SRCDIR variables out of the local scope.
***


At any rate, i fixed the problem with the script. So the main question is about retaining the display status of the Environmental Variable list.

Kachupp suggests (Thanks, K.) renaming the relevant variables so that they show up on top, but I'm hoping there's a more direct way.
 
Could you get the same results if you inserted the following between the ECHO OFF and SETLOCAL:

Code:
SET /a _yy_int=1
SET /a _mm_int=1
SET /a _dd_int=1
SET _ymd_str=``
SET _mm_str=``
SET _dd_str=``
 
Could you get the same results if you inserted the following between the ECHO OFF and SETLOCAL:

Code:
SET /a _yy_int=1
SET /a _mm_int=1
SET /a _dd_int=1
SET _ymd_str=``
SET _mm_str=``
SET _dd_str=``
Possibly, but I'm not having a problem with the current code, Charles. My question is about maintaining the view of the list of variables.

And it looks like the answer is No, there's no way to maintain it. A workaround is to rename the variables that are important, so they always show up at the top. But there doesn't seem to be any way to persist the scroll state of the current list.

Watching the variables seems to be the only viable option.
 

Similar threads

Back
Top