troubleshooting Question

Replacing a "tag" in a Variable with Value from Another

Avatar of D B
D BFlag for United States of America asked on
1 Comment1 Solution407 ViewsLast Modified:
I have a parameter file in CVS format that I process within powershell scripts. The file is in the format of:
VariableName, Value
Several of the variables include the path to specific files. The 'root' of this path is always the same, and in one instance is used several times in a variable (it is actually the commandline parameters for an SSIS package, executed with DtExec.exe.

What I would like to do is have something like:
in my parameter file. Within Pwershell, it will set the values of $ROOT and $PACKAGE_CMD_LINE to the appropriate values. Then, within the code, I want Powershell to replace the '%ROOT%' "tags" within the $PACKAGE_CMD_LINE variable with the value of the $ROOT variable, which has already been processed. Can someone assist me as to how this might be accomplished.
Subsequently, I would have a line that reads:
But $PACKAGE_CMD_LINE would have had occurances of '%ROOT%' replaced with the value of $ROOT.
Software Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

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