Search found 199 matches

by Sponge Belly
15 May 2015 16:21
Forum: DOS Batch Forum
Topic: re-use %* without corrupting it?
Replies: 5
Views: 2767

Re: re-use %* without corrupting it?

Hi Jeb, I was afraid you’d say something like that. But it’s even worse than I originally thought. If the program is executed from the command line using cmd like so: cmd /c prog.cmd "quoted ^ carets" unquoted ^^^^ carets The carets must be escaped a second time for the command line cmd. S...
by Sponge Belly
12 May 2015 14:13
Forum: DOS Batch Forum
Topic: re-use %* without corrupting it?
Replies: 5
Views: 2767

re-use %* without corrupting it?

Hello All! I want to make sure a script I’m writing runs in ANSI mode. The usual procedure is to check for a command line switch and call the script again if not present. The relevant line is: cmd /d /a /c call "%~dpnx0" /ansi %* Trouble is, when I run it with echo on, I notice that unquot...
by Sponge Belly
12 May 2015 13:52
Forum: DOS Batch Forum
Topic: split string into substrings based on delimiter
Replies: 37
Views: 32925

Re: split string into substrings based on delimiter

Hi Antonio, Your last example was amazing. Too bad I can’t understand it! Anyways, I was wondering if it’s possible to change the value of the original string from inside the loop caused by the string split operation… because if it is, we could append to the string what was just taken off, the strin...
by Sponge Belly
02 May 2015 13:25
Forum: DOS Batch Forum
Topic: split string into substrings based on delimiter
Replies: 37
Views: 32925

Re: split string into substrings based on delimiter

Hi Aacini,

Clever use of delayed expansion and set /a! 8)

Your method of storing all the intermediary results was so obvious when I read the example… so why didn’t I think of it myself? :cry:

Anyways, I changed the subject line as you suggested.

Laters!

- SB
by Sponge Belly
02 May 2015 09:17
Forum: DOS Batch Forum
Topic: split string into substrings based on delimiter
Replies: 37
Views: 32925

split string into substrings based on delimiter

Hi All! The syntax for extracting the first occurrence of a substring to end of string is well known: set "tail=%str:*x=%" And there’s a kludgy way to get the start of a string up to the first occurrence of the substring: set "head=%str:x=" & rem."%" I was messing a...
by Sponge Belly
02 Apr 2015 07:18
Forum: DOS Batch Forum
Topic: OT: anyone with an active msn.com account?
Replies: 3
Views: 2413

Re: OT: anyone with an active msn.com account?

jwoegerbauer wrote: You simply use your Microsoft Account data ( username / password ) to login to MSN.com Ah, if it were only that simple… To be clear, I need an email address in the form of firstname.lastname@msn.com. Hotmail or outlook.com won’t do. I’m locked out of a social networking account. ...
by Sponge Belly
02 Apr 2015 04:04
Forum: DOS Batch Forum
Topic: OT: anyone with an active msn.com account?
Replies: 3
Views: 2413

OT: anyone with an active msn.com account?

Hi Guys, We’re a retro bunch, so I thought it might be worth a try to ask here… Does anyone here still have an active msn.com account? If you do, I’m hoping you could set up an email alias for me (eg, firstname.lastname@msn.com) so I can access a social networking account tied to the email address. ...
by Sponge Belly
19 Mar 2015 04:42
Forum: DOS Batch Forum
Topic: create dummy files of exact size
Replies: 15
Views: 8489

Re: create dummy files of exact size

Hi Ed,

Thanks for pointing that out. Apologies for my sloppy terminology. The error has been corrected.

- SB
by Sponge Belly
17 Mar 2015 16:34
Forum: DOS Batch Forum
Topic: create dummy files of exact size
Replies: 15
Views: 8489

Re: create dummy files of exact size

Me Again! And a festive St. Patrick’s Day to everyone! Antonio, your bit logic confounds me. Please explain what’s going on in your last post. It’s late and I’m tired and I’ve had a bit too much to drink. In the meantime, here’s another approach that exploits the more /t option: @echo off & setl...
by Sponge Belly
14 Feb 2015 11:53
Forum: DOS Batch Forum
Topic: eol=; tokens=*
Replies: 18
Views: 16495

Re: eol=; tokens=*

Hi Dave, And a happy St Valentine’s Day to you! Thanks for explaining Jeb’s string magic. I get it now. The truncation only occurs on the last iteration of the for /l loop. The syntax is ignored the rest of the time. Devious. You wrote: When FOR /F processes a line, it first breaks the line into tok...
by Sponge Belly
13 Feb 2015 16:30
Forum: DOS Batch Forum
Topic: eol=; tokens=*
Replies: 18
Views: 16495

Re: eol=; tokens=*

Thanks to everyone who replied. Apologies for not responding sooner. @npocmaka Imho, the priority of for /f options in most cases is: ⋅ usebackq ⋅ skip ⋅ delims ⋅ eol ⋅ tokens Skip will count blank lines and lines beginning with eol. Delims is next b...
by Sponge Belly
01 Feb 2015 11:46
Forum: DOS Batch Forum
Topic: getTimestamp.bat for time and date processing
Replies: 45
Views: 50409

Re: getTimestamp.bat for time and date processing

@Foxi

Did you really say “look a gift horse in the mouse”? :lol:

Turn off the computer and go out into the fresh air for a walk! :D

- SB
by Sponge Belly
10 Jan 2015 06:47
Forum: DOS Batch Forum
Topic: eol=; tokens=*
Replies: 18
Views: 16495

Re: eol=; tokens=*

Hello Again! Here’s some more for /f weirdness: @echo off & setlocal enableextensions disabledelayedexpansion if not exist "hash10k.txt" ( for /l %%I in (1 1 1000) do <nul set /p "=##########" >>"hash10k.txt" <nul set /p "=# " >>"hash10k.txt" ) i...
by Sponge Belly
02 Jan 2015 04:15
Forum: DOS Batch Forum
Topic: eol=; tokens=*
Replies: 18
Views: 16495

Re: eol=; tokens=*

Hi Foxi, Sorry for not being clearer. The difference in the output from your first two examples is, as you inferred, what I was trying to draw attention to. When "delims=" is in effect, lines beginning with a semi-colon will be ignored. But when it’s "tokens=*", lines where the f...
by Sponge Belly
01 Jan 2015 17:11
Forum: DOS Batch Forum
Topic: eol=; tokens=*
Replies: 18
Views: 16495

eol=; tokens=*

Happy 2015! Has anyone else noticed this strange behaviour? @echo off & setlocal enableextensions disabledelayedexpansion for /f "delims=:" %%N in ( 'findstr /bln __DATA__ "%~dpnx0" ') do set lino=%%N for /f "usebackq skip=%lino% eol=; tokens=*" %%A in ( "%~dpn...