Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Deleting items from PATH

Options
  • 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: 91,688 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 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