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

Oct 15, 2011
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:
Oct 15, 2011
23
0
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.
 
Apr 2, 2011
1,427
10
54
North Carolina, USA
@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....
 
Oct 15, 2011
23
0
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.
 
Aug 9, 2009
228
1
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
 
Apr 2, 2011
1,427
10
54
North Carolina, USA
@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%
 
Oct 15, 2011
23
0
@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.
 
Apr 2, 2011
1,427
10
54
North Carolina, USA
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=``
 
Oct 15, 2011
23
0
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
Thread starter Title Forum Replies Date
K_Meinhard How to? Help window position Support 7
D Finding a string position in a larger string Support 2
D Get tab position and size Support 6
Jay Sage Failure of ACTIVATE to Set a Window Position Support 3
mscheuner TCMD v12 - how to make it remember position and settings? Support 2
davidebbo History popups doesn't remember its position/size Support 4
Peter Murschall v27.00.16/17: ENDLOCAL with exporting variables wipes out the complete Environment Support 2
D Unnecessary environment dependencies of TCC.EXE Support 3
T Portable Take Command installation for VDI environment Support 2
D v23 environment oddity Support 3
gschizas Take Command (Environment) doesn't show v2 ANSI colors Support 30
M Save the environment .. ;-) Support 2
Charles Dye Read-only environment variables wiped by SETLOCAL / ENDLOCAL Support 5
J Shell nesting level, and inherited environment variables Support 10
J Set environment variable from stdout of command Support 3
nickles Passing a variable to a command w/o adding it to the local environment Support 7
vefatica Environment refresh? Support 0
rfaquino WAD Apparently a bug when expanding environment variable %ProgramFiles(x86) Support 2
B WAD environment variable in TCC.exe Support 2
SeoulBigChris Save Environment (Tabs) on Exit? Support 3
fpefpe Documentation environment variables Support 3
fpefpe How to? Environment Variables changed Support 2
vefatica OT: Rex, how does CMD handle its environment? Support 0
M Updating environment variable from C++ fails erratically in version 14... Support 57
Frank problem with environment variable x86 vs. x64 Support 2
fpefpe volatile environment Support 5
daniel347x How to get Take Command to read in all current system environment variables that CMD.EXE sees? Support 13
D Environment in elevated process Support 1
Peter Bratton IDE environment window display Support 0
D Environment variable oddity Support 12
vefatica Got IDE's environment tab back Support 0
S blanks in environment variable paths Support 4
vefatica What environment variables does IDE need? Support 3
tinjaw Looking for best practice for custom environment on tabs Support 0
E Environment variable in tcmd.ini Support 14
I Environment variable in OPTION screen? Support 2
E Environment variables, set and input Support 2
J trouble redirecting output to environment variable Support 7

Similar threads