Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Dealing with parsing

$
0
0

I found this example:  ("OU=MTL1,OU=CORP,DC=FX,DC=LAB" -split ",")[0].substring(3)  when I run this it returns MTL1.  It uses the comma as the split.  I changed all of the comma's to backslashes ("OU=MTL1\OU=CORP\DC=FX\DC=LAB" -split "\")[0].substring(3) and it fails with this error:  parsing "\" - Illegal \ at end of pattern.

Why?

I need to parse our PATH statement.  We deployed some software which worked but it added a path to the Beginning of the path statement on every workstation and now, if you open up a CMD window and type in anything like MSIEXEC or XCOPY it can't find it.  You have CD to the %System32% folder and then run them for things to work.  But if I remove the path this program added to our PATH statement and add it to the very end it all works.  

So I have this:

$find = "C:\Program Files\WebEx\Productivity Tools"

$WinPath = Get-ChildItem Env:path

I need to find "C:\Program Files\WebEx\Productivity Tools" and delete it.  and then add it to the very end of the path.    But it does not like the backslash

 

 

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles