Please help me with a Power shell Script which rearranges Paths.

Posted by Hamish Grubijan on Stack Overflow See other posts from Stack Overflow or by Hamish Grubijan
Published on 2010-03-19T18:19:05Z Indexed on 2010/03/19 18:21 UTC
Read the original article Hit count: 147

Filed under:
|
|

Hi,

I have both Sybase and MSFT SQL Servers installed. There is a time when Sybase interferes with MS SQL because they have they have some overlapping commands.

So, I need two scripts:

A) When runs, script A backs up the current path, grabs all paths that contain sybase or SYBASE or SyBASE (you get the point) in them and move them all at the very end of the path, while preserving the order.

B) When it runs, script B restores the path from back-up.

Both script a and script b should affect the path immediately. So, if a.bat that calls patha.ps1, pathb.ps1 looks like so:

@REM Old path here
call patha.ps1
@REM At this point the effective path should be different.
call pathb.ps1
@REM Effective old path again

Please let me know if this does not make sense. I am not sure if call command is the best one to use.

I have never used P.S. before. I can try to formulate the same thing in Python (I know S.O. users tend to ask for "What have you tried so far"). Well, at this point I am VERY slow at writing anything in Power Shell language.

Please help.

© Stack Overflow or respective owner

Related posts about powershell

Related posts about scripting