Link to home
Start Free TrialLog in
Avatar of 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\" 
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.

Avatar of Bill Prew
Bill Prew

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial