Search found 199 matches

by Sponge Belly
19 Apr 2013 09:32
Forum: DOS Batch Forum
Topic: Output of command to variable
Replies: 5
Views: 5245

Re: Output of command to varialbe

Hi Wingnut and welcome to DosTips! Read this topic on WMIC and for /f . Also, you might try using double quotes around the path\to\executable inside the “in (...) clause” of your for /f loop. The apostrophes (') nested inside apostrophes might be causing confusion. Oh, and for /f "delims="...
by Sponge Belly
18 Apr 2013 16:52
Forum: DOS Batch Forum
Topic: can’t call func with "/?" as param
Replies: 2
Views: 1535

can’t call func with "/?" as param

Hi Everyone! Apologies if this topic has been discussed before, but I recently tried to write an error subroutine. I invoked it like this: call :error "file "%~1" not found " || goto end This worked just fine… until I passed "/?" as a filename. The program died, display...
by Sponge Belly
18 Apr 2013 15:39
Forum: DOS Batch Forum
Topic: update to win2unix
Replies: 8
Views: 4080

Re: update to win2unix

FoxiDrive wrote:Carlos, I tested it on three lines in a file and they were all converted to CRLF


And more will end the converted file with CRLF, regardless of what the original file ended with.

- SB
by Sponge Belly
17 Apr 2013 17:12
Forum: DOS Batch Forum
Topic: update to win2unix
Replies: 8
Views: 4080

Re: update to win2unix

Thanks again for the feedback, Mic! But I’ve updated win2unix yet again (see first post). I’m much happier with this latest version. It traps more errors and is more user-friendly. Read this post on my blog for the whole story. Btw, I discovered that findstr /v "^$" will do the same job as...
by Sponge Belly
03 Apr 2013 15:00
Forum: DOS Batch Forum
Topic: strlen questions
Replies: 3
Views: 1986

Re: strlen questions

@Endoro Thanks for the link, but I had recently discovered it myself. I’m surprised Dave Benham hasn’t reposted his answer here… @Jeb A parenthesis block is mostly a bit faster, as it's completly parsed and cached before it's executed. I never knew that! Let me rephrase that… I never realised that b...
by Sponge Belly
03 Apr 2013 05:42
Forum: DOS Batch Forum
Topic: strlen questions
Replies: 3
Views: 1986

strlen questions

Hi Jeb! You answered this SO question in May, 2012. Your code for StrLen was as follows: ( setlocal EnableDelayedExpansion set "s=!%~2!#" set "len=0" for %%P in (4096 2048 1024 512 256 128 64 32 16 8 4 2 1) do ( if "!s:~%%P,1!" NEQ "" ( set /a "len+=%%P&q...
by Sponge Belly
03 Apr 2013 04:39
Forum: DOS Batch Forum
Topic: dot before equals in set /p
Replies: 2
Views: 1357

Re: dot before equals in set /p

Hi Jeb!

Thanks for clearing that up for me.

- SB
by Sponge Belly
03 Apr 2013 03:48
Forum: DOS Batch Forum
Topic: multiple labels on one line
Replies: 2
Views: 1340

Re: multiple labels on one line

Hi Jeb! Thanks for replying. I read about the self-executing labels again. I think it’s starting to sink in. The less than in <:%bl.start% was confusing me. Now I get it. It has to be there to trick the parser into treating the line as a command and not a label, but goto treats labels literally and ...
by Sponge Belly
02 Apr 2013 13:35
Forum: DOS Batch Forum
Topic: multiple labels on one line
Replies: 2
Views: 1340

multiple labels on one line

Hi Again! I was thinking of writing a subroutine that would do different things depending on the name it was called by. Pretty soon, it had a long list of labels before the main body of the subroutine. I was wondering if it’s possible to have multiple labels on the same line using some twisted trick...
by Sponge Belly
02 Apr 2013 12:58
Forum: DOS Batch Forum
Topic: dot before equals in set /p
Replies: 2
Views: 1357

dot before equals in set /p

Hello All! I keep coming across lines of code like this: <nul set /p ".=some text" Why is there a dot before the equals sign? What does it do? It doesn’t seem to make any difference whether I leave it in or not. Is it for good luck? Does it keep the bugs away? Seriously, I presume it’s the...
by Sponge Belly
02 Apr 2013 12:47
Forum: DOS Batch Forum
Topic: more bug citation needed
Replies: 4
Views: 1745

Re: more bug citation needed

Hi Squashman! That was you? Should have guessed. I tried googling, but the words more“” and “bug” are too common and I couldn’t sift through all the results. Thanks for the link… btw, what is Ed talking about in that thread? Near as I can tell, he’s trying to output a range of lines from a file. Did...
by Sponge Belly
02 Apr 2013 10:45
Forum: DOS Batch Forum
Topic: more bug citation needed
Replies: 4
Views: 1745

more bug citation needed

Dear Batchers,

It was recently discovered that more will wait for a keypress after 65,535 lines, even if output is redirected to a file or sent down a pipe. But who was the first to report this bug? Is there a link to a post on a forum somewhere? I couldn’t find anything. :-(

- SB
by Sponge Belly
01 Apr 2013 06:52
Forum: DOS Batch Forum
Topic: VBS who gets text from URL and put it in .txt
Replies: 4
Views: 2056

Re: VBS who gets text from URL and put it in .txt

Hi Websec!

Have a look at abc0502’s program in the last user posted on forum topic. You should be able to modify his code to suit your needs. If you run into any more problems, feel free to post a question here, but I don’t know much about VBScript. Good luck!

- SB
by Sponge Belly
31 Mar 2013 16:48
Forum: DOS Batch Forum
Topic: Another way to create a line feed variable
Replies: 8
Views: 5525

Re: I there a way for save the result of Prompt $_

Hi Carlos! Borrowing from Walid2mi’s technique for splitting a CRLF pair (see seventh answer), and Jeb’s explanation of how newline variable hack works , I came up with this… @echo off & setlocal enableextensions set lftmp=%tmp%\lf.tmp echo(| (pause >nul & findstr "^" >%lftmp%) <nu...
by Sponge Belly
23 Feb 2013 17:41
Forum: DOS Batch Forum
Topic: filter text with certutil
Replies: 1
Views: 1165

filter text with certutil

Hello All! Herbert Kleebauer recently posted this article on the alt.msdos.batch.nt newsgroup. He demonstrates how to filter out all control characters and extended ASCII characters from an input file using the wondrous certutil. The possibilities for certutil are endless. It’s my new favourite toy....