troubleshooting Question

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

Avatar of zmau
zmau asked on
* Script Development Windows OS* path
1 Comment1 Solution16 ViewsLast Modified:
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.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros