Avatar of zmau
zmau
 asked on

windows script to remove element (s) from the path, and then run a program.

Hi all,
I need a script that
1) Gets the PATH environment
2) search for element (s), and if they are found, then removes them (more details later).
3) Sets the PATH environment
4) Runs a program - and vanish itself once the sub-program has started.

The language - is not important - as long as the job is done (and as long it does not require any installation). Seems to me that batch/VbScript are the "natural choice".


Now some more details about the elements that needs to be deleted :
Lets say that an element looks like "C:\Folder_A\Folder_b\Folder_C\".
1) I do not know if the actual element is
1.1) "C:\Folder_A\Folder_B\Folder_C\" 
     OR
1.2) "D:\Folder_A\Folder_B\Folder_C\"
(The truth is, that it is located in the "SystemDisk" - i.e. - on the same disk with "windows").
2) I do not know if the element is last one or not (i.e. I don't know if there is a ";" at the end of the element).
3) I need to be careful not to delete "C:\Folder_A\Folder_B\Folder_C\Folder_D\" from the path.


Thanks
zmau
* Script Development Windows OS* path

Avatar of undefined
Last Comment
Bill Prew

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Bill Prew

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23