0

I cant correctly insert the string i need as value,

I have this line of code replacing a value in a xml file:

 $XML.Task.Actions.Arguments = '-File `"' + $RootDir + '\' + $Folderpath + "\RunningTasks\workScheduler.ps1"`" 

I want it to replace the value with this: -File "C:\Workstation\Delivery\RunningTasks\workScheduler.ps1"

But i cant get the correct format in the way that the " characters are correct formatted.

Anyone that could point me in the correct direction? I have tried for a few days now :/

//Cheers

1 Answer 1

1

Had a hard time understanding the exact request,the XML or rest of the code would probably clear it up. Regardless I took a stab at it, if it's just to replace that one line in the XML this should work.

[xml]$data =  Get-Content -Path C:\Path\to\your\xml\File.Xml

$data.Task.Actions.Arguments = 'C:\Workstation\Delivery\RunningTasks\workScheduler.ps1'

$data.save('C:\Path\to\your\xml\File.Xml')
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.