Search found 177 matches

by Jer
28 Aug 2017 23:26
Forum: DOS Batch Forum
Topic: Does variable contain the target? Why doesn't this test work?
Replies: 2
Views: 2763

Re: Does variable contain the target? Why doesn't this test work?

Thank you Aacini for the correction. My test should only have been with setlocal EnableDelayedExpansion, and I was comparing the edited string with the target instead of the un-edited string. I read your answer in the link, a down-to-earth explanation of arrays and delayed expansion. Anyone interest...
by Jer
28 Aug 2017 20:30
Forum: DOS Batch Forum
Topic: Does variable contain the target? Why doesn't this test work?
Replies: 2
Views: 2763

Does variable contain the target? Why doesn't this test work?

I am submitting this code that gives inconsistent results. I want to test whether or not a string contains a character. I'll probably end up but wiser. Thanks for your assistance. Jerry @echo off & setlocal Set "string=ABDEFG" Set "target1=B" & Set "target2=C" E...
by Jer
26 Aug 2017 19:17
Forum: DOS Batch Forum
Topic: 2 questions: 1) copying code to forum & Windows 10 2) how to rearrange an array?
Replies: 5
Views: 4316

Re: 2 questions: 1) copying code to forum & Windows 10 2) how to rearrange an array?

Oops. Set "array( is my problem in the code. It should have a square open bracket: Set "array[

Thanks aGerman for the information about MS edge browser and the issue with copying and
pasting code in forums.
by Jer
26 Aug 2017 16:23
Forum: DOS Batch Forum
Topic: 2 questions: 1) copying code to forum & Windows 10 2) how to rearrange an array?
Replies: 5
Views: 4316

2 questions: 1) copying code to forum & Windows 10 2) how to rearrange an array?

Has this issue been addressed yet, where code copied from this forum includes ascii #160 character where the code is indented? Is this an issue with Windows 10 and/or microsoft edge browser? I am using Firefox browser on a Windows 10 64bit PC for this thread and will check to see if my code copied b...
by Jer
25 Mar 2017 23:27
Forum: DOS Batch Forum
Topic: Arithmetic Operation
Replies: 7
Views: 5980

Re: Arithmetic Operation

This code narrows down how many leading zeroes proceed the month number. If your data is 000000002, removing all but the last 2 digits with %var:~-2% guarantees that you have months 1-12, and adding leading zeroes beforehand helps in case the month number is 1-9 with no leading zeroes. "1"...
by Jer
14 Mar 2017 20:15
Forum: DOS Batch Forum
Topic: How to center align text.
Replies: 30
Views: 28222

Re: How to center align text.

Aacini, on my Windows 10 PC, your first indented line shows ascii chars. #160 #32 #160 in my editor's hextype function, and the batch file showed the error below with echo on. Overwriting all the blank indent space fixed it. á á á for /F %n in ("!indent!") do set "str=!spaces:~0,%n!!s...
by Jer
11 Mar 2017 10:40
Forum: DOS Batch Forum
Topic: How to center align text.
Replies: 30
Views: 28222

Re: How to center align text.

The variable name sizemax would not have been my choice because
it does not specify what is being sized in the original script.

I edited the batch code in my post above and renamed sizemax to strFixedLen, and
also added the functionality of indentation.
Jerry
by Jer
10 Mar 2017 17:19
Forum: DOS Batch Forum
Topic: How to center align text.
Replies: 30
Views: 28222

Re: How to center align text.

My thoughts are that when the sizemax value is manually set, the coder has taken into account that the console window width and the size of the font will display the text correctly inside whatever border thickness the box verticals happen to be. Box verticals may be doubled or more by the batch code...
by Jer
10 Mar 2017 13:03
Forum: DOS Batch Forum
Topic: How to center align text.
Replies: 30
Views: 28222

Re: How to center align text.

Center aligning to a fixed length is good to know. Here is an adaptation of that combined with other methods I have learned from this forum's participants. Post your comments if you find any part of this code needs correction or could be improved in some way. @echo off setlocal & setlocal set &q...
by Jer
06 Mar 2017 11:18
Forum: DOS Batch Forum
Topic: Using forfiles with Windows 10 vs Win 7 question
Replies: 5
Views: 5768

Re: Using forfiles with Windows 10 vs Win 7 question

Thanks to all. My problem: terminal naivete. Looking at the console font list I see that all the TueType fonts are indented in the list while the only line not indented is "Raster Fonts". I took this to be a label for the one font that followed This appeared to me to be a setback for my 3 ...
by Jer
05 Mar 2017 14:03
Forum: DOS Batch Forum
Topic: Using forfiles with Windows 10 vs Win 7 question
Replies: 5
Views: 5768

Re: Using forfiles with Windows 10 vs Win 7 question

My one raster font is SimSun-ExtB, which is variable width.

I tried installing several different fonts through regedit, then after re-booting
the new font is not in the console properties/font list.

I posted the issue in a Windows 10 forum but no resolution yet.
Jerry
by Jer
28 Feb 2017 22:44
Forum: DOS Batch Forum
Topic: Using forfiles with Windows 10 vs Win 7 question
Replies: 5
Views: 5768

Using forfiles with Windows 10 vs Win 7 question

The code below is part of a project the includes using any "friendly" DOS character in the borders of a box. This is batch only, not hybrid or 3rd party tools. The project was going well until I tried it on my new Window 10 PC. My forfiles method of capturing DOS characters into variables ...
by Jer
12 Nov 2016 20:45
Forum: DOS Batch Forum
Topic: How to replace asterisks in a string?
Replies: 14
Views: 15041

Re: How to replace asterisks in a string?

I got this idea from Aacini on a question about reducing code inside a for loop. This cuts out the asterisks--a little less painful than iterating through every character @Echo Off setlocal EnableDelayedExpansion Set "var1=no asterisk in original string" Set "var2=two ** words" S...
by Jer
10 Nov 2016 10:27
Forum: DOS Batch Forum
Topic: How to replace asterisks in a string?
Replies: 14
Views: 15041

Re: How to replace asterisks in a string?

I don't know if this is kosher but it works for me. Test each character in the string and re-assign the variable with all characters except the asterisk or insert something else in its place, like "[asterisk]" if you need to know it was there or need to have it out of the way temporarily a...
by Jer
30 Oct 2016 00:04
Forum: DOS Batch Forum
Topic: Batch Script to make ColorShow Checkerboards
Replies: 10
Views: 7983

Re: Batch Script to make ColorShow Checkerboards

edit 10/30/2016 - removed unnecessary code from randNumb function: Set /A "numb*=1" This thread is now checkered in more ways than one. Revisions to the code in the top post were completed and updated today. Name the file cboard.bat if you will be trying out cbr.bat entered below. A way wa...