Search found 319 matches
- 05 Apr 2011 22:23
- Forum: DOS Batch Forum
- Topic: Does string1 begin with string2 bug or is it just me?
- Replies: 4
- Views: 7647
Re: Does string1 begin with string2 bug or is it just me?
Fixed - thanks guys! :D ok, did i do something incorrect this time ? C:\work>type test.bat @echo off SETLOCAL ENABLEDELAYEDEXPANSION set string1="testing" set string2="test" set s=@@@%string1% if "%s%"=="!s:@@@%string2%=!" ( echo.%string1% doesnt begin with %...
- 05 Apr 2011 22:03
- Forum: DOS Batch Forum
- Topic: So, I am confused by this sort routine
- Replies: 3
- Views: 6572
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 ...
- 05 Apr 2011 21:01
- Forum: DOS Batch Forum
- Topic: So, I am confused by this sort routine
- Replies: 3
- Views: 6572
So, I am confused by this sort routine
Source : Sorting text with numbers - Sorting that handles numbers as numbers not text So , the little help text says ... test [n] n Specifies the character number, n, to begin each comparison. 3 indicates that each comparison should begin at the 3rd character in each line. Lines with fewer than n ch...
- 05 Apr 2011 20:07
- Forum: DOS Batch Forum
- Topic: String concatenation and arithmetic
- Replies: 4
- Views: 5022
Re: String concatenation and arithmetic
the first big mistake you make is to use batch for string/text processing and arithmetic. Batch (cmd.exe) has only rudimentary string processing capabilities and fails when you want to do floating point maths. (eg 1 + 2.4). I can say that for 99.999999% of the time, your system should have vbscript ...
- 05 Apr 2011 09:47
- Forum: DOS Batch Forum
- Topic: A Critique on "Trim Quotes - Remove surrounding quotes"
- Replies: 1
- Views: 4909
A Critique on "Trim Quotes - Remove surrounding quotes"
Source : Trim Quotes It says The FOR command can be used to safely remove quotes surrounding a string The demonstration is supposed to remove double quotes surrounding a string. If that's the case, a simple remove might do, such as the method demonstrated here . What if I feel that things are not so...
- 05 Apr 2011 09:25
- Forum: DOS Batch Forum
- Topic: Bug in "removing a substring using string substitution"
- Replies: 1
- Views: 4566
Bug in "removing a substring using string substitution"
Source: Remove - Remove a substring using string substitution Code tested: WinXP C:\work>type test.bat @echo off set str=the cat in the hat soothe my heart echo.%str% set str=%str:the =% echo.%str% C:\work>test.bat the cat in the hat soothe my heart cat in hat soomy heart The code is supposed to rem...
- 05 Apr 2011 08:52
- Forum: DOS Batch Forum
- Topic: Does string1 begin with string2 bug or is it just me?
- Replies: 4
- Views: 7647
Does string1 begin with string2 bug or is it just me?
Source: Does String1 begin with String2 Code being tested with slight modification ( on WinXP) @echo off SETLOCAL ENABLEDELAYEDEXPANSION set string1="ant" set string2="testing" set s=@@@%string1% if "%s%"=="!s:@@@%string2%!=" ( echo.%string1% doesn`t begin wit...
- 05 Apr 2011 08:10
- Forum: DOS Batch Forum
- Topic: Compare strings and deleting strings
- Replies: 3
- Views: 5361
Re: Compare strings and deleting strings
Alright. 1) Input: test test 1234 nothing apple In this example I need something that would strip out any matching strings. In this case the output to the new file would be test test while the original file would be 1234 nothing apple So here it goes, with gawk for windows..just one line of course ...
- 05 Apr 2011 07:46
- Forum: DOS Batch Forum
- Topic: A Critique on DOS limitation with maths and its workaround
- Replies: 0
- Views: 5020
A Critique on DOS limitation with maths and its workaround
Source1: Floating Point Maths Source2: set /A An example of normal maths with decimal values on DOS C:\work>set /a x=20 20 C:\work>set /a y=3*x 60 C:\work>echo %y% 60 C:\work>set /a y=3.3*x Missing operator. Oops! Batch/DOS does not support floating point maths for newbies to batch who does not know...
- 05 Apr 2011 07:31
- Forum: DOS Batch Forum
- Topic: A Critique on toHex function and its workaround
- Replies: 0
- Views: 5366
A Critique on toHex function and its workaround
Source: :toHex Limitation: This function works, but does not cater for big decimal numbers (limitation with DOS), eg (tested on WinXP) C:\work>test.bat 16 00000010 C:\work>test.bat 9999999991 Invalid number. Numbers are limited to 32-bits of precision. 00000000 Here's an implementation in vbscript f...
- 05 Apr 2011 07:20
- Forum: DOS Batch Forum
- Topic: Compare strings and deleting strings
- Replies: 3
- Views: 5361
Re: Compare strings and deleting strings
1) Parse through one file and cut out any strings that are exactly the same and have them redirected to a new file. So, for example, if I had three "test" in the file it would strip away all three of them and redirect to a new file. An example of your input and your expected output speaks...
- 05 Apr 2011 05:10
- Forum: DOS Batch Forum
- Topic: A Critique on toDec function and its workaround
- Replies: 0
- Views: 4972
A Critique on toDec function and its workaround
Source: :toDec Limitation: This function works, but does not cater for big hex numbers, eg (tested on WinXP) C:\work>test.bat F 15 C:\work>test.bat FFFFFFFF Invalid number. Numbers are limited to 32-bits of precision. Here's an implementation in vbscript for big hex numbers. Note: vbscript comes ins...
- 05 Apr 2011 01:09
- Forum: DOS Batch Forum
- Topic: asc, chr function, the less clumsy/messy version
- Replies: 0
- Views: 5222
asc, chr function, the less clumsy/messy version
Recently, there have been posts reinventing the asc, chr functions using batch. There is no need to re-invent the wheel. If native solutions is desired, vbscript (or powershell) should be used since its already provided at first installation and comes with already tried and tested functions such as ...
- 03 Apr 2011 18:55
- Forum: DOS Batch Forum
- Topic: Annoying string wont go away
- Replies: 5
- Views: 5796
Re: Annoying string wont go away
There's no need to download a third party tool for such a simple exercise. downloading stuff happens everyday. No excuse not to if you want to get the job done quickly and with ease of maintenance. Even M$ download stuff at the back end without anyone's notice. Windows update, anti-virus updates et...
- 03 Apr 2011 08:34
- Forum: DOS Batch Forum
- Topic: Annoying string wont go away
- Replies: 5
- Views: 5796
Re: Annoying string wont go away
Hey guys, I am trying to reformat a current list of all the students where I work. The text file I have has 2-3 students per line and each are delimited by a space. I want to be able to create a list with each student on it's own line. Not every line has 3 students though, some only have 2. What I ...