Welcome!

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

SignUp Now!

Guess Where Skip This Line Takes You or How About Jump To This Line?

Jan
179
2
Guess where Skip This Line takes you? I had the breakpoint set as you can see. I ran up to the breakpoint and then expecting to Skip A Line because I already know that Undefined isn't processed correctly in the debugger so I try to work past it and because that's what it says I click it on the debug menu and select Skip This Line but it's really Skip This Statement. Ignoring the IF and jumping to the GOTO and treating it as an unconditional jump. Worthless. Trying not to let it beat me. I restarted and when I hit the breakpoint I moved my cursor down to the next line 78 and used the Jump To This Line and where did it take me to the last line in the script. A double error. Realize that there's no way to breakpoint the Goto and Skip This Line just executes it, there's no option to Skip 2 statements or 20 as the case might be.

This Debugger needs serious work.

Screenshot_20260621_191744_RVNC Viewer.webp
 
Your IF syntax is faulty - IF DEFINED tests for the existence of an environment variable. You're passing it a batch variable (and then wrapping it in brackets). That syntax will not work in CMD or TCC or BDEBUGGER.

I cannot reproduce your problem with "Skip this Line" -- it does not execute the GOTO. I also cannot reproduce your problem with "Jump to this line". Exactly how are you positioning the cursor before selecting those menu entries?

I have mentioned before that an IF is a single statement (and line) as far as CMD or TCC are concerned, regardless of how many lines you spread it across. So you cannot jump into the middle of an IF, or skip lines inside an IF command group.
 
I have mentioned before that an IF is a single statement (and line) as far as CMD or TCC are concerned, regardless of how many lines you spread it across. So you cannot jump into the middle of an IF, or skip lines inside an IF command group.
And I have said to you before that I've not done that. You've also said the breakpoint has to go on the first line and I disproved that by watching it blow by the first line and then adding a second breakpoint to the ending paren which was successful
Exactly how are you positioning the cursor before selecting those menu entries?
What am I a child? Now I don't know how to select a menu item? Check yourself.

Your IF syntax is faulty - IF DEFINED tests for the existence of an environment variable. You're passing it a batch variable (and then wrapping it in brackets). That syntax will not work in CMD or TCC or BDEBUGGER.
Again I'll repeat myself...this is how Microsoft is saying to validate a variable passed on the CMD line that could have spaces. So you're confirming a problem.
Your IF syntax is faulty - IF DEFINED
I've never heard that you have to validate a command line variable a different way than an environmental variable. I have heard that there are issues wrapping them in quotes. Variables are 1 and 0's stored in memory. Is there something specific about cmd line parameters vs environmental variable's that is exposed in an IF statement? Below are brackets and double brackets and quotes with brackets and just quotes. They all are wrong running in CMDebug; If there's something specific that would make you happy please let me know.

Screenshot_20260621_190217_RVNC Viewer.webp


Your saying this example is wrong because I not coding it correctly? Rather than telling me I'm doing something wrong why not tell me the correct way in your opinion? Seems that when no variable is passed it still thinks it is.

So here's your way. Came out exactly the same.

Screenshot_20260621_222415_RVNC Viewer.webp



Screenshot_20260621_223332_RVNC Viewer.webp



Screenshot_20260621_223441_RVNC Viewer.webp
 
I have tried everything I could think of beyond commenting the entire thing out to get around this. Just isn't happening. If you have something helpful to add I'd appreciate that. How it works one day and not the next is beyond me. Keying the checkpoint by hand was the only way to get it break but as soon as I step-into it it goes right to the end.

Screenshot_20260621_224430_RVNC Viewer.webp
 
So here's your way. Came out exactly the same.

In the screen shot immediately following this statement it appears you had entered a 2 in the batch arguments combo box at the top of the screen. That would make the if test true and "defined" the correct output. (Also, I have found that whatever was in the batch arguments combo box when you hit the start button to start a debugging session will be what is used in the session...even if you clear out the combo box before stepping through the code.)

The next two screen shots seem to show that the % is missing (%~1 vs ~1).

I'd suggest a couple of things to help get your questions/issues resolved.

1. Add the following line before your if statement to show in the console exactly what is being interpreted as the first parameter to the batch file when you run it.
Code:
echo "%1"

2. Get rid of the brackets and the tilde and only use a single set of quotes on either side of the comparison. Matching up multiple pairs of double quotes can sometimes be confusing, and may not be parsed the way it appears to read to you. So the first line of the if could be written more simply like this
Code:
if "%1"=="" (

3. Recognize that the people in this forum are actually trying to help you successfully use the debugger to get a complicated script that you didn't write to run. Maybe tone down the sarcasm.
 
What am I a child? Now I don't know how to select a menu item? Check yourself.

That's not what I'm asking. What I am asking is how you are positioning the cursor on the line that you want to skip / jump to. Are you clicking on that line and then selecting the menu entry (which is the right way), or are you doing something else (like the GOTO dialog, and then selecting the menu entry, which will not work)?

Again I'll repeat myself...this is how Microsoft is saying to validate a variable passed on the CMD line that could have spaces. So you're confirming a problem.

You use IF DEFINED to validate an environment variable. But you're not passing an environment variable. There's a variety of ways to check for the existence of any type of variable (batch, alias, environment, internal, etc.), but DEFINED only works with environment variables. The most common way of checking to see if a variable exists (assuming you only want to use CMD syntax) is if "%var" == "" ..."

So here's your way. Came out exactly the same.

But does the variable exist? Your command line example showed that it did, and the debugger showed that it did. Are you saying that the variable does not exist, and your command line example was wrong?
 
In the screen shot immediately following this statement it appears you had entered a 2 in the batch arguments combo box at the top of the screen. That would make the if test true and "defined" the correct output. (Also, I have found that whatever was in the batch arguments combo box when you hit the start button to start a debugging session will be what is used in the session...even if you clear out the combo box before stepping through the code.)
That should be fixed if true because that's a serious error.
 
3. Recognize that the people in this forum are actually trying to help you successfully use the debugger to get a complicated script that you didn't write to run. Maybe tone down the sarcasm.
I've spent a lot of time documenting problems whether JPSoft wants to recognize them as problems or not. WAD or working as designed doesn't mean it's working correctly it just means the existing code is working. I even realized that this CMDebug was cloned from MS ISE and that's why it's not intimately understood. You tweeked it but you didn't write it. But to reply to someone that took their time to help make a better product with snark is of course going to set me off. Telling me that maybe I don't know how to select from a menu is insulting and it doesn't win you any points. Telling me that I'm doing something wrong but not what's right isn't helpful. Telling me that I can't break apart an if structure multiple times when at no point did I ever show a screen capture where there was a breakpoint in the middle of an if yet that answer is supposed to satisfy me as a resolution, again insulting especially since I wrote that it was on the FIRST LINE (except once when I couldn't get it to break at all I put a breakpoint on every line but this wasn't without reasoning. I wasn't going off half-cocked. I was told I had to break on the first line of an if and yet that didn't work and just from watching an IF in the debugger I knew that the current line was always the last line of the IF never the first and so I had proven that a breakpoint worked on the last line of the If structure. No one even acknowledged it. Of course if I felt like any of this was taken seriously that would help rather than just taking it from my BUG designation to your WAD designation shows how unseriuosly it is taken. There have been no answers for any of these problems yet WAD. Oh the entire script won't stop at a breakpoint WAD. Can't see the value by hovering over any vairable in and If of set statement WAD. There's been no resoltution to anythiing except the help icon not working in the watch list area or whatever it's called. And to tell me that you cannot recreate something doesn't sound lilke you put much effort into it. No follow-up questions not even about the verison that I'm running no questions about is it continuing to occur isn't really all that convincing but I can tell you in the real world I be getting paid seriuous money for what I'm doing for free. And I'm not making progress on my scripts because I can't get through a run without some debugger issue.
 
I've spent a lot of time documenting problems whether JPSoft wants to recognize them as problems or not. WAD or working as designed doesn't mean it's working correctly it just means the existing code is working. I even realized that this CMDebug was cloned from MS ISE and that's why it's not intimately understood. You tweeked it but you didn't write it. But to reply to someone that took their time to help make a better product with snark is of course going to set me off. Telling me that maybe I don't know how to select from a menu is insulting and it doesn't win you any points. Telling me that I'm doing something wrong but not what's right isn't helpful. Telling me that I can't break apart an if structure multiple times when at no point did I ever show a screen capture where there was a breakpoint in the middle of an if yet that answer is supposed to satisfy me as a resolution, again insulting especially since I wrote that it was on the FIRST LINE (except once when I couldn't get it to break at all I put a breakpoint on every line but this wasn't without reasoning. I wasn't going off half-cocked. I was told I had to break on the first line of an if and yet that didn't work and just from watching an IF in the debugger I knew that the current line was always the last line of the IF never the first and so I had proven that a breakpoint worked on the last line of the If structure. No one even acknowledged it. Of course if I felt like any of this was taken seriously that would help rather than just taking it from my BUG designation to your WAD designation shows how unseriuosly it is taken. There have been no answers for any of these problems yet WAD. Oh the entire script won't stop at a breakpoint WAD. Can't see the value by hovering over any vairable in and If of set statement WAD. There's been no resoltution to anythiing except the help icon not working in the watch list area or whatever it's called. And to tell me that you cannot recreate something doesn't sound lilke you put much effort into it. No follow-up questions not even about the verison that I'm running no questions about is it continuing to occur isn't really all that convincing but I can tell you in the real world I be getting paid seriuous money for what I'm doing for free. And I'm not making progress on my scripts because I can't get through a run without some debugger issue.
I hit the wrong button and it's no in post reply mode but there's no cancel.

The next two screen shots seem to show that the % is missing (%~1 vs ~1).
Yeah, that's a screw up. If I put it back you're saying that the "2" is stuck in memory so it's not going to properly evaluate them anyway. So I guess I go through and redo them just without the 2. This resident 2 needs to be fixed.
 
I even realized that this CMDebug was cloned from MS ISE and that's why it's not intimately understood. You tweeked it but you didn't write it.
Just to be clear, I had nothing to do with writing any of this. I'm just an ordinary user trying to help. Rex wrote all of Take Command/TCC/CMDebug etc. and understands it better than any of us ever will.

Oh the entire script won't stop at a breakpoint WAD.
There was an issue, which I reported separately and which Rex has a fix for, related to Breakpoints not always working if they were loaded from a saved .bp file from a previous debugging session. Until that fix is released, I found that if I clear all breakpoints loaded from previous sessions and manually reset the breakpoints I want, then I have seen them always work. Not sure if that is the issue you were running into or not.

Can't see the value by hovering over any vairable in and If of set statement WAD
My experience shows me that even though an if Statement is a single statement, each component of it is parsed and executed sequentially when you single step through the code in the debugger. If you are single stepping through the code and hovering over a variable before the if statement gets to the point where a variable is set, then you will not see a value. Could this be what you are experiencing?

you're saying that the "2" is stuck in memory
Based on Rex's description, I think the Combo box for Batch arguments serves two purposes. (1) It shows you what arguments were passed in on the command line which started the debugger (2) It allows you to change the arguments before you start a debugging session.

After you start a debugging session, the place to change the arguments is in the Batch Parameters pane.

If there is a bug or opportunity for improvement it would be to prevent changes to the ComboBox once a debugging session has been started to avoid confusion with where changes can be made.

That's why I suggested echoing the actual parameter (%1) to the console before the if statement - so you can see what is being used.


@rconn please correct me if I've got any of this wrong.
 
I hope we can put how the brackets vs " to a rest they are all identical. I would submit that I don't need the ~ but it didn't hurt anything either. I redid the blank input at the end because of the prior statement of once entered it carries over. Does not seem to be the case. BTW you could have done this to shown why your way was right and mine was wrong.

I'll have to go back to the other ticket to see why I thought the defined / not defined wasn't working. The typo made it appear like my claim was valid. Is there still an issue with environment variables? I wouldn't put environmental variables through the same validation as I would command line entries because they are internally defined. If the command line is valid than the set statements will create valid environmental variables or do you think I'm missing something?

Screenshot_20260622_125557_RVNC Viewer.webp
Screenshot_20260622_125655_RVNC Viewer.webp
Screenshot_20260622_125809_RVNC Viewer.webp
Screenshot_20260622_125950_RVNC Viewer.webp
Screenshot_20260622_130117_RVNC Viewer.webp
 
Back
Top