Thanks, I knew that construct and that SO thread already.

Actually that's exactly how I inserted the "DISABLED" part, see demo here.

Problem is that, like already explained, I would need to know all possible entries beforehand instead of being able to exclude anything following C:\perls\...

I also looked into batch solutions to split on ; and loop over it. But that's not trivial because, believe it or not, a ";" could be part of a filename° and appending to a variable in a loop is not trivial in WinB*tch language... 🤦

In short: batch is really a horrible language for a perverted file-system invented by a distorted sadist. ˛

I'm thinking now it's a good bargain between mental sanity, maintainability and performance to use a Perl one-liner returning the cleaned path. But only called for that edge case, i.e. if batch detects C:\perls in the path.

(I could also use PowerShell, but why adding one more technology at that place?)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

°) tho, I could ignore this problem as long as the paths of my Perl installations are clean, which goes without saying.

˛) I have to apologize that was too harsh.

It's rather a mix of the worst parts of bash and zsh, with the source google translated to Chinese and back to English but via Khoisan, while purging all documentation during compilation with random settings.


In reply to Re^2: Cleaning %PATH% with WinBatch by LanX
in thread Cleaning %PATH% with WinBatch by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.