Search found 222 matches

by Sponge Belly
27 Mar 2014 07:03
Forum: DOS Batch Forum
Topic: findstr regex
Replies: 9
Views: 9120

Re: findstr regex

Hi Dave,

Great idea! Why didn’t I think of that? :oops:

Only problem is, embedded CRs will trigger a false positive. That’s why I was asking if it was possible to specify a range of all characters (including CR) except for LF.

- SB
by Sponge Belly
26 Mar 2014 19:30
Forum: DOS Batch Forum
Topic: findstr regex
Replies: 9
Views: 9120

findstr regex

Dear DosTippers, I’m trying to compose a findstr regex. A wrap-around regex that starts with a line feed and then matches any character except a line feed, followed by zero or more carriage returns and another line feed. Trouble is, "." (dot) matches everything except LF or CR, and "[...
by Sponge Belly
26 Mar 2014 19:08
Forum: DOS Batch Forum
Topic: type nul >con suppresses output
Replies: 5
Views: 5245

type nul >con suppresses output

Hello All! :-)

I stumbled across this the other day:

Code: Select all

(cmd /d /u /c type nul >con
echo(first
echo(second
echo(third)


Only the first echo is displayed. The other two are suppressed. :?:

Can anyone explain what’s going on here?

TIA!

- SB
by Sponge Belly
05 Mar 2014 05:03
Forum: DOS Batch Forum
Topic: mshta and javascript
Replies: 31
Views: 68587

Re: mshta and javascript

Hi Einstein1969! Is this what you were looking for? set ldt=For Each objItem in GetObject(""winMgmts:\\.\root\cimv2""^).^ ExecQuery(""Select LocalDateTime from Win32_OperatingSystem ^ where Primary=True""^):CreateObject(""Scripting.FileSystemObject&q...
by Sponge Belly
03 Feb 2014 10:57
Forum: DOS Batch Forum
Topic: Reading tab and new line characters
Replies: 4
Views: 4372

Re: Reading tab and new line characters

Hi Steph! :-)

Read the recent slice.cmd topic. It should answer your questions. And if you’re still having difficulties after that, don’t hesitate to get in touch.

- SB
by Sponge Belly
03 Feb 2014 09:48
Forum: DOS Batch Forum
Topic: How to handle a comma in a filename with WMIC?
Replies: 32
Views: 32586

Re: How to handle a comma in a filename with WMIC?

Yes.There's no big difference when you use WMI classes through the activex objects?But after I saw this code started to wonder if it is necessary to create WMI objects to the time? Both javascript and vbscript have a good set date/time functions. True, but look at the output from this little snippe...
by Sponge Belly
01 Feb 2014 05:04
Forum: DOS Batch Forum
Topic: type not breaks on 1a
Replies: 2
Views: 2620

Re: type not breaks on 1a

Hi Carlos,

Reread the recent Ctrl-Z Blues topic. You contributed towards the end, but I recommend reading the whole thing from the beginning. You’ll find out more about Ctrl-Z than you ever wanted to know! ;-)

- SB
by Sponge Belly
31 Jan 2014 16:02
Forum: DOS Batch Forum
Topic: slice.cmd
Replies: 9
Views: 9485

Re: slice.cmd

Hi Carlos, I updated my code with your suggestion. And the program now exits more cleanly when the last line of output is reached. I’ve often thought of writing a better version with features like inverted ranges, numbered lines with padded zeros, and support for long lines, etc. But to implement so...
by Sponge Belly
31 Jan 2014 15:24
Forum: DOS Batch Forum
Topic: How to handle a comma in a filename with WMIC?
Replies: 32
Views: 32586

Re: How to handle a comma in a filename with WMIC?

Thanks for the pointers, npocmaka. But this thread on a Russian forum proved to be instructive. Retouching the script I found there, I ended up with: set ^"js=javascript:close(new ActiveXObject('Scripting.^ FileSystemObject'^).GetStandardStream(1^).Write(new String(new ^ Enumerator(new ActiveXO...
by Sponge Belly
31 Jan 2014 10:57
Forum: DOS Batch Forum
Topic: Create nul and all ascii characters with only batch
Replies: 110
Views: 115867

Re: Create nul and all ascii characters with only batch

Hi Guys, First off, thanks to aGerman for explaining the makecab hack. I wouldn’t have thought of that in a million years! How did Carlos even think of it? I hereby nominate Carlos for promotion to Expert. Any seconds? Next up, Dave Benham wrote: What really blows me away is that SET /P can read bot...
by Sponge Belly
29 Jan 2014 16:49
Forum: DOS Batch Forum
Topic: How to handle a comma in a filename with WMIC?
Replies: 32
Views: 32586

Re: How to handle a comma in a filename with WMIC?

Thanks Foxi! :D

I forgot to mention that it should also work for any poor Windows XP Home bunnies out there who don't have the wmic command available to them.

Btw, does anyone know how to do the mshta equivalent of the following:

Code: Select all

wmic os get localdatetime


It might prove useful.

TIA! ;-)

- SB
by Sponge Belly
29 Jan 2014 16:34
Forum: DOS Batch Forum
Topic: slice.cmd
Replies: 9
Views: 9485

Re: slice.cmd

Hello Carlos! Slice was one of the first Batch programs I tried to write. I couldn’t output the lines verbatim so I asked for help on the alt.msdos.batch.nt newsgroup and a long, rambling thread unfolded. Your program was one of several submitted. Now that I have a better idea of what I’m doing, I c...
by Sponge Belly
29 Jan 2014 14:55
Forum: DOS Batch Forum
Topic: What's wrong with XP's for /f delimiter ?
Replies: 15
Views: 20609

Re: What's wrong with XP's for /f delimiter ?

Welcome to DosTips, Dave! Penpen’s answer is probably overkill for your requirements. Below is a little snippet that stores a tab in a variable along with an example of how to use it. Should work with any version of Windows from XP onwards. for /f "delims=" %%t in ('mshta ^"javascript...
by Sponge Belly
29 Jan 2014 08:25
Forum: DOS Batch Forum
Topic: Create nul and all ascii characters with only batch
Replies: 110
Views: 115867

Re: Create nul and all ascii characters with only batch

Hello All! Wow! What a fascinating thread. Allow me to tie up a few loose ends. I thought Penpen’s final version of CreateNul.cmd was definitive… and then I saw Carlos’s optimisation of my snippet. I’m going to be controversial and call it a draw! Squashman, I think this is the post on forfiles you ...
by Sponge Belly
28 Jan 2014 16:26
Forum: DOS Batch Forum
Topic: How to handle a comma in a filename with WMIC?
Replies: 32
Views: 32586

Re: How to handle a comma in a filename with WMIC?

Hi Again! I wondered why nobody replied to my posts. Then I realised Foxi was talking about square brackets in the filename and not the parentheses around the name clause of the wmic command. Anyways, here’s my mshta solution which is very much in vogue these days thanks to npocmaka and Einstein1969...