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...
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 ...
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.
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?
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...
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...
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...
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%%" ...
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=^" ^&^^ ^"^^^&^"^& !^^!^^^...
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...