Search found 220 matches

by Sponge Belly
22 Apr 2024 13:44
Forum: DOS Batch Forum
Topic: Need help copying a line of text from a file to another (without mangling it) :AppendFileLineToFile
Replies: 5
Views: 1932

Re: Need help copying a line of text from a file to another (without mangling it) :AppendFileLineToFile

Hi Shodan,

I’m not sure what you’re trying to accomplish, but I suggest you read Calling Functions from a Library, especially Post #4 by Penpen.

HTH! :)

- SB
by Sponge Belly
10 Apr 2024 14:59
Forum: DOS Batch Forum
Topic: check file contains only printable 7-bit ASCII characters
Replies: 0
Views: 3410

check file contains only printable 7-bit ASCII characters

Hello All! :) A little proof-of-concept program I put together: @echo off & setLocal enableExtensions disableDelayedExpansion (call;) %= sets errorLevel to 0 =% for /f "tokens=*" %%A in ('chcp') do for %%B in (%%A) do set "cp=%%~nB" mode con cp select=437 >nul ((for /l %%I in (1 1 70) do pause) >nul...
by Sponge Belly
10 Apr 2024 08:16
Forum: DOS Batch Forum
Topic: How to dynamically escape % symbols?
Replies: 4
Views: 414

Re: How to dynamically escape % symbols?

Hi SIMMS7400,

You may want to read the Mask Password with Asterisk topic. ;)

- SB
by Sponge Belly
08 Apr 2024 13:34
Forum: DOS Batch Forum
Topic: Success or failure echo
Replies: 3
Views: 303

Re: Success or failure echo

Hi Squashman! I didn’t know that about robocopy. Good to know, thanks! 8) Gussy, don’t use the "command && success || failure" syntax with robocopy. Follow the example on the SS64 web page referenced by Squashman. Make sure you start with the highest errorLevel and work your way down to the lowest. ...
by Sponge Belly
08 Apr 2024 08:34
Forum: DOS Batch Forum
Topic: Success or failure echo
Replies: 3
Views: 303

Re: Success or failure echo

Hi Gussy! :) If a command executes successfully, it sets errorLevel to 0, a non-zero integer otherwise. There’s an easy way to test for this and to take appropriate action. The syntax goes a little something like this: command && ( success ) || ( failure ) So, your code example would be rewritten as...
by Sponge Belly
31 Dec 2023 13:44
Forum: DOS Batch Forum
Topic: Split string to characters
Replies: 32
Views: 43431

Re: Split string to characters

Hi Again! :) I updated my split string to characters code based on Jeb’s nested for loops technique : @echo off & setLocal enableExtensions disableDelayedExpansion set "hex=0 1 2 3 4 5 6 7 8 9 A B C D E F" set str="!%%^&*~|<>?" set "chr=" & set "N=0" setLocal enableDelayedExpansion if not defined st...
by Sponge Belly
30 Dec 2023 10:34
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 75
Views: 111706

Re: infinite loop with break condition

Hi Jeb! :) You wrote: The trick is to nest multiple FOR-Loops, each with a low counting number, like FOR /L %%# in (1 1 16) do ( FOR /L %%# in (1 1 16) do ( FOR /L %%# in (1 1 16) do ( FOR /L %%# in (1 1 16) do ( ... the loop code is here REM Stop the code by goto :break ) ) ) ) :break Obviously thi...
by Sponge Belly
27 Apr 2023 05:18
Forum: DOS Batch Forum
Topic: Need Help w Batch Rename
Replies: 1
Views: 1525

Re: Need Help w Batch Rename

Hi Mike! :)

Please read the following posts:
Both written by the legendary Dave Benham.

HTH! 8)

- SB
by Sponge Belly
25 Feb 2023 08:47
Forum: DOS Batch Forum
Topic: Check File Size Properties
Replies: 12
Views: 4188

Re: Check File Size Properties

Hi Xiro! :)

Please read this Microsoft Community thread.

HTH!

- SB
by Sponge Belly
19 Feb 2023 17:20
Forum: DOS Batch Forum
Topic: creating a batch file to pause for user input to open a specific folder in windows...
Replies: 2
Views: 1907

Re: creating a batch file to pause for user input to open a specific folder in windows...

Hi Gizibo! :)

Please read this post (#32) by Aacini.

Once you have the folder chosen by the user stored in a variable (eg, %folderName%), you can open a File Explorer window at that location by doing the following:

Code: Select all

start "" "%folderName%"
HTH! 8)

- SB
by Sponge Belly
30 Oct 2022 06:31
Forum: DOS Batch Forum
Topic: reverse string without goto
Replies: 10
Views: 14341

Re: reverse string without goto

Hi Again! :) Belated thanks to Aacini and T3RRY for their excellent contributions. Below is my final word on the topic—a Batch/JScript hybrid: @if (@X==@Y) @then :: Batch @echo off & setLocal enableExtensions disableDelayedExpansion set ^"strFwd=short ^" ^< %% ^| ^^ ! string^" set "strRev=" & for /f...
by Sponge Belly
13 Oct 2022 15:43
Forum: DOS Batch Forum
Topic: OT: WhatsApp Woes
Replies: 0
Views: 30206

OT: WhatsApp Woes

Hello All! :) Forgive me for going off topic, but I’m in a bind. I accidentally deleted 3 weeks worth of WhatsApp messages and media, and I want them restored. No WhatsApp or iCloud backup, nada. :oops: I tried something called Phone Rescue. It could show me the deleted messages. So they are still o...
by Sponge Belly
07 Aug 2022 05:43
Forum: DOS Batch Forum
Topic: JSORT.BAT v4.2 - problems with german umlauts
Replies: 16
Views: 7708

Re: JSORT.BAT v4.2 - problems with german umlauts

Excellent work, Steffen! 8)

Just one question… what do you mean by ACP 1252 and OEMCP 850?

How can I have 2 different code pages active at once? If I chcp 1252, how can the code page be 850 at the same time?

Thanks!

- SB
by Sponge Belly
06 Aug 2022 05:59
Forum: DOS Batch Forum
Topic: JSORT.BAT v4.2 - problems with german umlauts
Replies: 16
Views: 7708

Re: JSORT.BAT v4.2 - problems with german umlauts

aGerman wrote:
Replace all occurrences of WScript.Echo with WScript.StdOut.WriteLine
Thanks for the tip, Steffen! :)

But can you explain why replacing WScript.Echo with WScript.StdOut.WriteLine solves the umlaut problem?

- SB