Search found 159 matches

by Jer
18 Jan 2020 16:53
Forum: DOS Batch Forum
Topic: If/Else in 1 line--only do something from Else statement
Replies: 6
Views: 464

Re: If/Else in 1 line--only do something from Else statement

My O/S: Microsoft Windows [Version 10.0.18362.592] Obviously your Windows version is superior to mine :wink: @echo off setlocal set "code=100" If %code% gtr 0 If %code% leq 255 () else set "code=" If defined code (echo %code% is within limits) else echo value is NOT within limits C:\Temp\DOSBatch>te...
by Jer
18 Jan 2020 11:25
Forum: DOS Batch Forum
Topic: If/Else in 1 line--only do something from Else statement
Replies: 6
Views: 464

Re: If/Else in 1 line--only do something from Else statement

penpen, I will use your "( rem: )" solution to do nothing when a numeric value passes the lower and upper limits test. Speed in not an issue because only a few values are checked from a command-line entry. Thanks for your solution: If %code% gtr 0 If %code% leq 255 ( rem: ) else set "code=" Entries ...
by Jer
17 Jan 2020 19:20
Forum: DOS Batch Forum
Topic: If/Else in 1 line--only do something from Else statement
Replies: 6
Views: 464

Re: If/Else in 1 line--only do something from Else statement

DQ2000, what happened when you tested your solution? I get the error message: ) was unexpected at this time. Something like this works: If %code% gtr 0 If %code% leq 255 (set .=) else set "code=" but I'm asking to see if if there's a right way to do this, as I am prone to do it the wrong way first.
by Jer
17 Jan 2020 16:53
Forum: DOS Batch Forum
Topic: If/Else in 1 line--only do something from Else statement
Replies: 6
Views: 464

If/Else in 1 line--only do something from Else statement

What is the best coding form in writing this If/Else statement on 1 line? I have "echo OK" where nothing should be done. What should I replace it with? "(rem)" acted as if the batch file did nothing. Sorry if this topic was covered somewhere in history and I forgot the solution :? Thanks. Jerry @ech...
by Jer
25 Nov 2019 16:14
Forum: DOS Batch Forum
Topic: Can I get access to an ascii character not in the standard set?
Replies: 38
Views: 9491

Re: Can I get access to an ascii character not in the standard set?

As posted in this forum, TinyPic image hosting is no longer available and this caused my images to go away. These links, after right clicking and choosing open in a new tab, pull up my project sample images for me. Clicking on the link just shows a white screen on my Windows 10 PC w/Firefox browser....
by Jer
09 Aug 2019 10:58
Forum: DOS Batch Forum
Topic: SORT Order not working correction
Replies: 8
Views: 5158

Re: SORT Order not working correction

Here's my solution which is to create an artificial sort field. I'm looking forward to reading Antonio's solution. I rearranged lines in the source text to show that it works. @echo off setlocal EnableDelayedExpansion set "srce=source.txt" set "del=|" >_temp.txt ( For /F "tokens=1-6* delims=%del%" %...
by Jer
05 Jun 2019 20:17
Forum: DOS Batch Forum
Topic: For Loop - How do I keep the delimiter?
Replies: 0
Views: 7921

For Loop - How do I keep the delimiter?

Keeping the delimiter when parsing a string with a For loop was covered previously; I can't find it and I forgot how it was done. It was some trick with the asterisk. From a user entry, remove "+10" from string "509 1116+10 88" leaving "509 1116 88" The "+" option is valid when browsing the whole da...
by Jer
08 May 2019 12:19
Forum: DOS Batch Forum
Topic: Fire-Colored particle system
Replies: 6
Views: 1518

Re: Fire-Colored particle system

I have questions about two lines. If someone could explain, that would be great. What does "& echo !esc![?25l" do? In the assignment of screen, how is "H" doing its job? Changing it to some other character gives different spacing and frequency. "G" and "I" produce many more characters than H. Thanks...
by Jer
08 May 2019 09:23
Forum: DOS Batch Forum
Topic: Fire-Colored particle system
Replies: 6
Views: 1518

Re: Fire-Colored particle system

Any idea why the batch code does this? The termination is my doing. This is all displayed in a smaller window, same as your image. My O/S: Microsoft Windows [Version 10.0.17134.706] [38;2;191;71;7m█[0m [38;2;175; 63;7m█[0m;199;7[3[38;2;199;71;[38;2; 175;63;7m█[0m38;2;223;79;7m█[0m38;[3 8;2;191;71;7m...
by Jer
28 Mar 2019 18:46
Forum: DOS Batch Forum
Topic: How can I close batch file from any prompt in code?
Replies: 2
Views: 916

Re: How can I close batch file from any prompt in code?

That works! And very easy to do. My code uses your :choice function, and uppercase X will be the keypress (and also as an entry at the prompt for text input) to exit completely from any screen. spacebar and Enter key are assigned error level 0 in the choice function. I'll use exit /b 50 to communica...
by Jer
28 Mar 2019 13:39
Forum: DOS Batch Forum
Topic: How can I close batch file from any prompt in code?
Replies: 2
Views: 916

How can I close batch file from any prompt in code?

I would like to add <shift+X> as an option to exit from the batch script from any of the prompts for input, and not close the cmd window. Can this be done? I searched a little and found no answer. I tried a goto :exitNow but the code flows from the label that has exit /b, back to where the goto was ...
by Jer
25 Mar 2019 12:05
Forum: DOS Batch Forum
Topic: Title command to unclutter title bar question
Replies: 2
Views: 1094

Re: Title command to unclutter title bar question

Yesterday "Title" was not working for me. During code development, "cmd" appeared in the title bar and repeated itself. Today, just "Title" is keeping the bar clear. There is a post on Stack Overflow about how Kedit for Windows, my text editor, saves files. It states that Kedit does not keep the bla...
by Jer
24 Mar 2019 22:36
Forum: DOS Batch Forum
Topic: Title command to unclutter title bar question
Replies: 2
Views: 1094

Title command to unclutter title bar question

Title help says
TITLE [string]

string Specifies the title for the command prompt window.
Are there any secrets on how to keep the title bar clean?
Is this the best solution assigning character #255 as the string?

Code: Select all

Title ÿ
Thanks.
Jerry
by Jer
18 Dec 2018 00:07
Forum: DOS Batch Forum
Topic: Can I get access to an ascii character not in the standard set?
Replies: 38
Views: 9491

Re: Can I get access to an ascii character not in the standard set?

I removed double quote character temporary substitution from my batch code and found that tests and my set of samples ran without error. Also, strings are now being passed to functions by reference. The CHCP font issue is no longer mysterious (i.e., not unique to my PC) as explained by Dave in post ...
by Jer
14 Nov 2018 18:32
Forum: DOS Batch Forum
Topic: Can I get access to an ascii character not in the standard set?
Replies: 38
Views: 9491

Re: Can I get access to an ascii character not in the standard set?

About passing the variable name to a function and getting its value in the function, there it was in front of me in strLen function. Yes I am passing variable names to functions many times. It did not occur to me to use !%~1! inside a function, as strLen does. I will try it when I return and see if ...