Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Deleting items from PATH

  • 09-05-2005 12:52PM
    #1
    Closed Accounts Posts: 59 ✭✭


    Does anyone know a nice handy wee method for removing several items from the start of PATH from command line?
    (i.e. remove from C:\whatever\bin;C:\whatever\data;etc....)


Comments

  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 95,993 Mod ✭✭✭✭Capt'n Midnight


    Do you mean editing the path or deleting files along the path ?

    Either way you could use the FOR command to parse it
    [php]for /F "tokens=1-26* delims=;" %a in ("%PATH%") do echo c%a %b %c ...[/php]

    You could then pass the whole lot onto a batch file and use SHIFT to process each one at a time. ( or just lines - Echo %1, Echo %2 ... Echo %9 )

    Probably easier ways though..


  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    generally I do a setlocal and endlocal at the beginning and end of the batch file. This then allows you to erase the path and set it to whatever you like, and it will be automatically reset back (as will any other environment variables).


  • Closed Accounts Posts: 59 ✭✭Darkwing Duck


    Thanks for that lads, couldn't seem to find anything on it, definitly came in useful


Advertisement