Search found 202 matches

by Sponge Belly
02 Nov 2013 08:58
Forum: DOS Batch Forum
Topic: ctrl-z blues
Replies: 24
Views: 8578

ctrl-z blues

Hello All! Imagine a test file called hi.txt with the contents “hi there” (no quotes and no newline). It’s possible to print out the characters of the file one by one using a little trick I learnt from Judago : cmd /d /u /c type hi.txt | find /v "" h i t h e r e This would be extremely use...
by Sponge Belly
23 Oct 2013 12:03
Forum: DOS Batch Forum
Topic: FTP Download only new files any file type
Replies: 7
Views: 4363

Re: FTP Download only new files any file type

Hi Thlockler, Sorry for not replying sooner. I was on my holidays! Anyways, I don’t fully understand your question. The script makes two connections to the ftp host. On the first pass, it builds a list of all files matching the findstr pattern. On the second pass, it downloads only those files that ...
by Sponge Belly
16 Sep 2013 15:35
Forum: DOS Batch Forum
Topic: reverse string without goto
Replies: 4
Views: 4136

reverse string without goto

Building on what I learnt from Dave Benham’s demonstration of escaping special characters inside a for /f loop’s in (…) clause , and Aacini’s use of a for /l loop called by a cmd subshell to emulate a while loop , I’ve cobbled together an alternative method for reversing a string that does not requi...
by Sponge Belly
10 Aug 2013 15:50
Forum: DOS Batch Forum
Topic: strimmer: a string trimmer
Replies: 5
Views: 3495

Re: strimmer: a string trimmer

Thanks for the explanation, Jeb! :-)

- SB
by Sponge Belly
10 Aug 2013 13:40
Forum: DOS Batch Forum
Topic: vagaries of for /f loops
Replies: 4
Views: 2119

Re: vagaries of for /f loops

Thanks Penpen and Dave! In the second example, multiple parameter separators (, ; = <SP> and <TAB>) are indeed replaced with a single space… but not dots. Note that if you quote the string, any leading whitespace and the opening quote itself will be stripped away and the rest of the string will be d...
by Sponge Belly
07 Aug 2013 09:15
Forum: DOS Batch Forum
Topic: strimmer: a string trimmer
Replies: 5
Views: 3495

Re: strimmer: a string trimmer

Thanks Penpen…

Edit: Please read revised code.

- SB
by Sponge Belly
03 Aug 2013 16:20
Forum: DOS Batch Forum
Topic: strimmer: a string trimmer
Replies: 5
Views: 3495

strimmer: a string trimmer

Hi All! :-)

Below is an alternative technique for trimming leading and trailing spaces and tabs from a string…

Edit: Please read revised code.

- SB
by Sponge Belly
01 Aug 2013 08:22
Forum: DOS Batch Forum
Topic: vagaries of for /f loops
Replies: 4
Views: 2119

vagaries of for /f loops

Dear DosTips, I came across something puzzling while researching an alternative method of trimming whitespace (spaces and/or tabs) from the head and tail of a string. To trim any whitespace on the left of a string, simply do this: for /f "tokens=*" %%a in ("%string%") do set &quo...
by Sponge Belly
09 Jul 2013 18:40
Forum: DOS Batch Forum
Topic: how to read input from a pipe
Replies: 9
Views: 4533

Re: how to read input from a pipe

Hello Sambasiva! :-)

I recommend the find or findstr prompt issue topic. See my contribution at the end. :D

If you have any further questions, don’t hesitate to ask.

- SB
by Sponge Belly
09 Jul 2013 18:26
Forum: DOS Batch Forum
Topic: Some Explaination on these
Replies: 6
Views: 2944

Re: Some Explaination on these

Hello Flora! This line of code is a clever but ugly hack: SET v=%v:;=&rem.% It has the effect of discarding everything in the string after the first occurrence of semi-colon (inclusive). It is the opposite of: SET v=%v:*;=% which removes everything before the first occurrence of a semi-colon (se...
by Sponge Belly
09 Jul 2013 17:58
Forum: DOS Batch Forum
Topic: FTP Download only new files any file type
Replies: 7
Views: 4363

Re: FTP Download only new files any file type

Hi Again! I tinkered with your version of the FTP script and eventually got it to work: @Echo Off & setlocal enableextensions Set "FtpCommand=ls" Call:extractFileSection "[Ftp Script 1]" "-">"%temp%\%~n0.ftp" Set "FileList=" For /F "Delims=&...
by Sponge Belly
08 Jul 2013 09:13
Forum: DOS Batch Forum
Topic: batch programming help
Replies: 3
Views: 1663

Re: batch programming help

Hello VVomble! :-)

Um… what’s wrong with… ?

Code: Select all

set "hex1=02ac08"
echo(%hex1%


Or am I missing something? And why are you using set /p? What are you trying to achieve? Please explain your task in more detail.

- SB
by Sponge Belly
08 Jul 2013 09:04
Forum: DOS Batch Forum
Topic: FTP Download only new files any file type
Replies: 7
Views: 4363

Re: FTP Download only new files any file type

Hi Again!

Please post your source code. Trim comments and remove usernames and passwords. But one thing I did notice—and this is a long shot—is a missing quote before the ls command.

Good luck! ;-)

- SB
by Sponge Belly
06 Jul 2013 15:44
Forum: DOS Batch Forum
Topic: FTP Download only new files any file type
Replies: 7
Views: 4363

Re: FTP Download only new files any file type

Hi CastorTroy! FindStr regular expressions are different from wildcard patterns. Try something like this: set FindStrArgs=/x "..*\...*" The above should output only filenames containing at least one dot. If it doesn’t, let me know. If that isn’t what you need, again get back to me and we’l...
by Sponge Belly
06 Jul 2013 08:34
Forum: DOS Batch Forum
Topic: Using setver with win98 boot disk and msdos 6.22 programs ?
Replies: 4
Views: 3206

Re: Using setver with win98 boot disk and msdos 6.22 program

Hi Again! :-)

Have you tried The CD Forum? The site is devoted to bootable CDs and boasts no less than 8 subforums. Surely one of the gurus there will be able to help you. And when he/she does, please come back and let us know what pearls of wisdom were bestowed on you. ;-)

- SB