Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Cleaning %PATH% with WinBatch

by LanX (Saint)
on May 22, 2022 at 22:48 UTC ( [id://11144103]=note: print w/replies, xml ) Need Help??


in reply to Re: Cleaning %PATH% with WinBatch
in thread Cleaning %PATH% with WinBatch

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11144103]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-25 16:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found