Search found 237 matches

by DosItHelp
27 Aug 2017 02:18
Forum: DOS Batch Forum
Topic: Alignment using batchscript
Replies: 8
Views: 10550

Re: Alignment using batchscript

plasma33,

Here is a longest-common-sequence implementation http://www.dostips.com/?t=Experimental.StringDiff as a starting point.
It could be improved and converted to a function.
by DosItHelp
21 Aug 2017 01:44
Forum: DOS Batch Forum
Topic: Extracting substrings from strings
Replies: 4
Views: 7570

Re: Extracting substrings from strings

Aacini's solution shortened: @echo off setlocal EnableDelayedExpansion set "last=" ( for /F "delims=" %%a in (input.txt) do ( set "line=!last!%%a" set "last=" set "line=!line:-= !" for %%b in (!line!) do ( if defined last echo !last! set "last=%...
by DosItHelp
21 Aug 2017 00:09
Forum: DOS Batch Forum
Topic: Animation
Replies: 1
Views: 4775

Re: Animation

very clever :D
by DosItHelp
21 Aug 2017 00:04
Forum: DOS Batch Forum
Topic: FOR LOOP Variable setting as %C - how to solve?
Replies: 3
Views: 5953

Re: FOR LOOP Variable setting as %C - how to solve?

Hey SIMMS7400, It is possible you want tokens= 1, 2* ? Also last line did you mean SET "C=_ %%C " ? FOR /F "tokens=1,2* delims=_" %%A IN ("%~n0") DO ( IF ["%%A"] NEQ [""] SET "A=%%A" IF ["%%B"] NEQ [""] SET "B=_%%B&...
by DosItHelp
26 Sep 2011 00:02
Forum: DOS Batch Forum
Topic: [How to] dec to hex and hex to dec conversion bat
Replies: 6
Views: 51758

Re: [How to] dec to hex and hex to dec conversion bat

Voodooman,
Nice trick using %=exitcode% variable.

Wanted to mention that dostips also lists two functions for converting hex to dec and dec to hex:
http://www.dostips.com/DtTipsArithmetic ... tion.toDec
http://www.dostips.com/DtTipsArithmetic ... tion.toHex
:)
by DosItHelp
25 Sep 2011 23:44
Forum: DOS Batch Forum
Topic: [solved] Hide keyboard input in a batch
Replies: 13
Views: 85256

Re: [solved] Hide keyboard input in a batch

Batcher, your solution doesn't seem to work for Win7 64bit. I get this error: --------------------------- Unsupported 16-Bit Application --------------------------- The program or feature "\??\C:\Users\Peter\AppData\Local\Temp\in.com" cannot start or run due to incompatibity with 64-bit ve...
by DosItHelp
06 Apr 2011 00:09
Forum: DOS Batch Forum
Topic: Bug in "removing a substring using string substitution"
Replies: 1
Views: 5438

Re: Bug in "removing a substring using string substitution"

Yes - the command interpreter allows for simple string substitution not necessarily word substitution. You think this example doesn't get the point across? If someone want's to propose a better example for string substitution then I would consider it for inclusion. Note: vbscript comes installed by ...
by DosItHelp
05 Apr 2011 22:46
Forum: DOS Batch Forum
Topic: Does string1 begin with string2 bug or is it just me?
Replies: 4
Views: 9099

Re: Does string1 begin with string2 bug or is it just me?

The double quotes are trouble. 5th character of string1 is not a double quote. this should work: set string1="test"ing set string2="test" or this: set "string1=testing" set "string2=test" or this: set string1=testing set string2=test or even this set "str...
by DosItHelp
05 Apr 2011 22:33
Forum: DOS Batch Forum
Topic: A Critique on "Trim Quotes - Remove surrounding quotes"
Replies: 1
Views: 5682

Re: A Critique on "Trim Quotes - Remove surrounding quotes"

"safely remove double quotes surrounding a string" was meant to mean surrounding the whole string, not counting double quotes within the string.
Any suggestions on how to formulate this better are welcome.
by DosItHelp
05 Apr 2011 22:23
Forum: DOS Batch Forum
Topic: So, I am confused by this sort routine
Replies: 3
Views: 7825

Re: So, I am confused by this sort routine

Ok, I see what you mean. This has been fixed now, character position starts with 1 now and not with 0.
Thanks a lot for pointing this out!
by DosItHelp
05 Apr 2011 22:08
Forum: DOS Batch Forum
Topic: Does string1 begin with string2 bug or is it just me?
Replies: 4
Views: 9099

Re: Does string1 begin with string2 bug or is it just me?

Fixed - thanks guys! :D

old:
if "%s%"=="!s:@@@%string2%!=" (
new:
if "%s%"=="!s:@@@%string2%=!" (
by DosItHelp
05 Apr 2011 21:52
Forum: DOS Batch Forum
Topic: So, I am confused by this sort routine
Replies: 3
Views: 7825

Re: So, I am confused by this sort routine

"Specifies the character number, n, to begin each comparison." means that n=4 indicates that each comparison should begin at the 4th character in each line. Adding a space after the 4th character should clarify: abc1 0def3 <== 0 abc9 00def4 <== 0 results from 00, 4 is greater than 3 abc2 9...
by DosItHelp
30 Mar 2011 20:43
Forum: DOS Batch Forum
Topic: Enhanced toHex function
Replies: 3
Views: 8057

Re: Enhanced toHex function

dbenham, Very good! Inspired by your post the :toHex function has been made more efficient and now handles negative numbers. I preferred the leading zeros option and so the new implementation is a bit different than you suggested. Many thanks for your input! http://www.dostips.com/DtCodeCmdLib.php#F...
by DosItHelp
30 Mar 2011 18:43
Forum: DOS Batch Forum
Topic: Oddball: Need to make a string of "=" that changes...
Replies: 2
Views: 6902

Re: Oddball: Need to make a string of "=" that changes...

BrentNewland, Try this: @echo off set "title=Hi There (Title up to 60 characters long)" setlocal set "frame=%title% ============================================================" echo.%frame:~60%>> log.txt echo.=%title%=>> log.txt echo.%frame:~60%>> log.txt endlocal outputs: =====...
by DosItHelp
29 Mar 2011 18:13
Forum: DOS Batch Forum
Topic: Batch HELP
Replies: 5
Views: 9303

Re: Batch HELP

Haha - you just did his home work for him ... I bet :D