Search found 222 matches

by Sponge Belly
06 Sep 2016 04:19
Forum: DOS Batch Forum
Topic: ExitCode in JScript != ErrorLevel in Batch
Replies: 4
Views: 4958

Re: ExitCode in JScript != ErrorLevel in Batch

Hi Steffen! Thanks for your helpful answer… and not pointing out the glaring error in my definition of inFile2 (now corrected). It didn’t occur to me that Exec runs commands asynchronously and that I had to wait for fc to finish. I did read the documentation, I just didn’t absorb it. Maybe it’s time...
by Sponge Belly
05 Sep 2016 14:18
Forum: DOS Batch Forum
Topic: ExitCode in JScript != ErrorLevel in Batch
Replies: 4
Views: 4958

ExitCode in JScript != ErrorLevel in Batch

Hello All! I wanted to compare 2 files using JScript to see if they were the same or not. I thought the Exec method’s ExitCode property would return 0 for yes, and 1 for no. But it always returns 0: @if (@X==@Y) @then @echo off & setlocal enableextensions disabledelayedexpansion cscript //nologo...
by Sponge Belly
05 Sep 2016 10:39
Forum: DOS Batch Forum
Topic: Regsrv32 exploit
Replies: 11
Views: 12469

Re: Regsrv32 exploit

Hi Foxi, Thanks for your helpful suggestion and sorry for not replying sooner. I’ve been wracking my brains over this and I haven’t been able to come up with a practical solution. Ideally, I want to write robust code that will work on all versions of Windows and won’t be tripped up by gotchas like c...
by Sponge Belly
28 Aug 2016 03:03
Forum: DOS Batch Forum
Topic: How to rename files like 00080.jpg to 01080.jpg?
Replies: 11
Views: 9266

Re: How to rename files like 00080.jpg to 01080.jpg?

Hi Doscode! :)

Maybe Dave Benham’s JREN.BAT can do what you want. Requires some knowledge of JavaScript regular expressions.

HTH!

- SB
by Sponge Belly
04 Aug 2016 08:16
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets
Replies: 550
Views: 2009948

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

Hi Foxi! :)

Sweden gave the world ABBA, Volvo, and Stieg Larsson.

We have Switzerland to thank for yodeling, cuckoo clocks, and Roger Federer.

Need I say more?

- SB
by Sponge Belly
01 Jul 2016 15:30
Forum: DOS Batch Forum
Topic: Regsrv32 exploit
Replies: 11
Views: 12469

Re: Regsrv32 exploit

Hi Vasil, Sorry for the delay in replying. I was referring to the SO link Jeb mentioned in his reply to the OP. If I understand correctly, the following Registry keys are queried every time a for /f loop is executed: HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun HKEY_CURRENT_USER\S...
by Sponge Belly
06 May 2016 13:02
Forum: DOS Batch Forum
Topic: Regsrv32 exploit
Replies: 11
Views: 12469

Re: Regsrv32 exploit

Hi Guys! Fascinating discovery, but not even MS can ignore a security hole that big. No doubt it will be patched in an upcoming update. I’m more concerned with the AUTORUN issue, which I was unaware of until now. Short of querying the Registry to make sure the AUTORUN key is empty whenever I want to...
by Sponge Belly
27 Apr 2016 14:17
Forum: DOS Batch Forum
Topic: Can formfeed character be written to file
Replies: 5
Views: 6885

Re: Can formfeed character be written to file

npocmaka wrote:

Code: Select all

cls>>temp.txt


Excellent! :)
by Sponge Belly
27 Apr 2016 13:48
Forum: DOS Batch Forum
Topic: Passing batch argument to Choice command
Replies: 20
Views: 18722

Re: Passing batch argument to Choice command

Aacini wrote:

Code: Select all

set "vars=apl1=2,apl2=,apl3=kup,aplN=etc"
set "%vars:,=" & set "%"


Brilliant! 8)
by Sponge Belly
04 Apr 2016 13:17
Forum: DOS Batch Forum
Topic: Text Flow (like word wrapping to a margin) of free form text lines
Replies: 7
Views: 38095

Re: Text Flow (like word wrapping to a margin) of free form text lines

Hi John A!

Have a look at PrepMessage.cmd posted to alt.msdos.batch.nt by Frank P Westlake in January, 2013.

HTH! :)

- SB
by Sponge Belly
28 Nov 2015 08:18
Forum: DOS Batch Forum
Topic: revamped forum
Replies: 38
Views: 36056

revamped forum

Hello All! I’m just going to come right out and say it. I’m not happy with the revamped forum. I have several issues. First, I’m having difficulties loading the home page. Several attempts are usually required. I suspect the honking big Google Ads frame may have something to do with it. Next, the ‘V...
by Sponge Belly
22 Nov 2015 11:49
Forum: DOS Batch Forum
Topic: split string into substrings based on delimiter
Replies: 44
Views: 88241

Re: split string into substrings based on delimiter

Hello Again! Below is my revised code for trimming whitespace from the start and end of a string: @echo off & setlocal enableextensions disabledelayedexpansion :: nasty str full of poison chars set ^"str= ^^^" ^^^&^^ ^&^"^& %%os%% !random! ^" :: double all quotes ...
by Sponge Belly
22 Nov 2015 11:01
Forum: DOS Batch Forum
Topic: call set bug?
Replies: 8
Views: 7658

Re: call set bug?

Hi Jeb, :)

Thanks for the explanation, but I think I’ll stick with Dave Benham’s icall macro if I ever find myself in a situation where I’m forced to make extensive use of call set.

Cheers!

- SB
by Sponge Belly
22 Nov 2015 10:47
Forum: DOS Batch Forum
Topic: two findstr questions
Replies: 27
Views: 26247

Re: two findstr questions

Hi Aacini! :)

I explored a findstr /no solution, but decided it was too messy. There’s no way to tell Unix and Windows line-endings apart, line numbers must be decremented, and what if the last line in the file happens to be the longest? :?

Cheers!

- SB
by Sponge Belly
21 Nov 2015 08:55
Forum: DOS Batch Forum
Topic: two findstr questions
Replies: 27
Views: 26247

find longest line in text file

Hello Again! I returned to this problem after a long break with a fresh perspective. Sure enough, the only practical solution, imho, is a hybrid script: @if (@X==@Y) @then @echo off & setlocal enableextensions disabledelayedexpansion for /f "tokens=1,2" %%A in (' cscript //nologo //e:j...