Search found 197 matches

by Sponge Belly
04 Jan 2017 15:10
Forum: DOS Batch Forum
Topic: Putting a PC to sleep from a batch
Replies: 27
Views: 16167

Re: Putting a PC to sleep from a batch

Hi All! I borrowed Penpen’s C# Hybrid , transplantedd some code I found in this CodeHill article , and ended up with suspend.cmd: // // >nul 2>nul & @goto main /* :main @echo off & setlocal enableextensions disabledelayedexpansion set "csc=" pushd "%SystemRoot%\Microsoft.NET\F...
by Sponge Belly
31 Dec 2016 14:25
Forum: DOS Batch Forum
Topic: line numbers in find vs findstr
Replies: 10
Views: 4364

Re: line numbers in find vs findstr

Hi Again, Null characters are notoriously difficult to deal with, as discussed in Robust Line Counter . If an input text file is contaminated with null characters, the best course of action is to get rid of them. But if that isn’t possible, there are workarounds. For example, the following snippet a...
by Sponge Belly
28 Dec 2016 09:24
Forum: DOS Batch Forum
Topic: line numbers in find vs findstr
Replies: 10
Views: 4364

Re: line numbers in find vs findstr

Hi Spodermon! Happy Christmas and welcome to the forum. Paste the following (untested) code into an empty Notepad window and save the file as lineNo.cmd: @echo off & setlocal enableextensions disabledelayedexpansion for /f "delims=:" %%A in (' findstr /bilnc:"portshow 0" &quo...
by Sponge Belly
10 Nov 2016 04:29
Forum: DOS Batch Forum
Topic: Resetting multiple variables at once
Replies: 4
Views: 1963

Re: Resetting multiple variables at once

Hello All! :)

Check out this technique developed by Aacini.

- SB
by Sponge Belly
07 Nov 2016 13:47
Forum: DOS Batch Forum
Topic: Foxidrive has left us
Replies: 29
Views: 15067

Re: Foxidrive has left us

Hello All, I am shocked and saddened to hear of FoxiDrive’s untimely death. He tirelessly and selflessly devoted his free time to helping others. He leaves behind an enduring legacy in the form of thousands of patient and thoughtful answers to programming questions asked on forums and newsgroups fro...
by Sponge Belly
06 Sep 2016 04:19
Forum: DOS Batch Forum
Topic: ExitCode in JScript != ErrorLevel in Batch
Replies: 4
Views: 2083

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: 2083

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: 5579

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: 3012

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.5 - regex text processor with support for text highlighting and alternate character sets
Replies: 461
Views: 342633

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: 5579

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: 5579

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: 3138

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: 8206

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: 34127

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