Search found 222 matches
- 21 Nov 2015 04:53
- Forum: DOS Batch Forum
- Topic: call set bug?
- Replies: 8
- Views: 7642
Re: call set bug?
Hi Jeb, Ah, now I get it! The weird syntax is to guard against the unlikely event that a user has a file called "set.bat" or "set<Space>.bat" on his/her PATH. However did you think to check for that? And one last thing, you said: I reinvent the wheel this year, but this time my n...
- 18 Nov 2015 14:59
- Forum: DOS Batch Forum
- Topic: call set bug?
- Replies: 8
- Views: 7642
Re: call set bug?
Hi Penpen and Jeb! Thanks for the explanations. Just one more pitfall to look out for when writing a Batch file! On a related topic, Jeb wrote in this post : set "safeSet=set^ "" call %%safeSet%% var=123" I was wondering why you didn’t just write: set "safeSet=set" call...
- 17 Nov 2015 14:26
- Forum: DOS Batch Forum
- Topic: Iterating For The Last 60 Days
- Replies: 8
- Views: 6390
- 14 Nov 2015 15:10
- Forum: DOS Batch Forum
- Topic: call set bug?
- Replies: 8
- Views: 7642
call set bug?
Hello All! Sorry I haven’t posted in a while. My mind has been… elsewhere. Anyways, could someone please explain what’s going on here? @echo off & setlocal enableextensions disabledelayedexpansion set ^"str= hello ^&^"^& world! ^" (call;) call set "str1=%%str%%" ...
- 10 Aug 2015 13:22
- Forum: DOS Batch Forum
- Topic: Using Variable As For-Loop Token Value
- Replies: 7
- Views: 10186
Re: Using Variable As For-Loop Token Value
Hello All! Sorry I’m late to the discussion, as usual. But my solution takes advantage of the popping the CALL stack technique Siberia-Man told us about on June 7th: @echo off & setlocal enableextensions disabledelayedexpansion set ^"str=^" ^&^^ ^"^^^&^"^& !^^!^^^...
- 29 Jun 2015 15:35
- Forum: DOS Batch Forum
- Topic: re-use %* without corrupting it?
- Replies: 5
- Views: 5638
Re: re-use %* without corrupting it?
Hi Guys! Sorry for the delay in replying. Here’s what I (eventually) came up with: @echo off & setlocal enableextensions disabledelayedexpansion (call;) set "crlf=%tmp%\crlf.tmp" >"%crlf%" echo( for %%A in ("%crlf%") do set "crlfSize=%%~zA" if %crlfSize% n...
- 23 Jun 2015 11:43
- Forum: DOS Batch Forum
- Topic: Exception Handling with batch using erroneous GOTO
- Replies: 16
- Views: 33330
Re: Exception Handling with batch using erroneous GOTO
Hello All!
Fascinating topic. But could someone show me how to use this new technique to stop a for /l loop in its tracks?
TIA!
- SB
Fascinating topic. But could someone show me how to use this new technique to stop a for /l loop in its tracks?
TIA!
- SB
- 22 May 2015 10:10
- Forum: DOS Batch Forum
- Topic: split string into substrings based on delimiter
- Replies: 44
- Views: 88000
Re: split string into substrings based on delimiter
Hi Ed, Thanks for the explanation. Still can’t quite wrap my head around Aacini’s code, though. Will keep trying. In the meantime, I’ve rekindled my obsession with finding the best way to trim leading and trailing whitespace from a string: @echo off & setlocal enableextensions disabledelayedexpa...
- 15 May 2015 16:21
- Forum: DOS Batch Forum
- Topic: re-use %* without corrupting it?
- Replies: 5
- Views: 5638
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...
- 12 May 2015 14:13
- Forum: DOS Batch Forum
- Topic: re-use %* without corrupting it?
- Replies: 5
- Views: 5638
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...
- 12 May 2015 13:52
- Forum: DOS Batch Forum
- Topic: split string into substrings based on delimiter
- Replies: 44
- Views: 88000
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...
- 02 May 2015 13:25
- Forum: DOS Batch Forum
- Topic: split string into substrings based on delimiter
- Replies: 44
- Views: 88000
Re: split string into substrings based on delimiter
Hi Aacini,
Clever use of delayed expansion and set /a!
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?
Anyways, I changed the subject line as you suggested.
Laters!
- SB
Clever use of delayed expansion and set /a!
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?
Anyways, I changed the subject line as you suggested.
Laters!
- SB
- 02 May 2015 09:17
- Forum: DOS Batch Forum
- Topic: split string into substrings based on delimiter
- Replies: 44
- Views: 88000
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...
- 02 Apr 2015 07:18
- Forum: DOS Batch Forum
- Topic: OT: anyone with an active msn.com account?
- Replies: 3
- Views: 4393
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. ...
- 02 Apr 2015 04:04
- Forum: DOS Batch Forum
- Topic: OT: anyone with an active msn.com account?
- Replies: 3
- Views: 4393
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. ...