PowerShell simple task

Hello,

$A = "ABC1A2BC2DC2E3#A2BC1ABC2DCE3"

I need to replace all "2" before # with "abc" so result will be: ABC1AabcBCabcDCabcE3#A2BC1ABC2DCE3

How can it be achieved? Can it be done via .replace method or -replace operator? If both ways work please show me.

Thank you!


August 19th, 2015 12:14pm

Actually replace [ ] symbols in a path while copying data using Start-BitsTransfer cmdlet. -destination parameter only recognizes symbols '[ '] only in path. I need path [ ] symbols be replaced only before last \. Is it clear now?
Free Windows Admin Tool Kit Click here and download it now
August 19th, 2015 1:56pm

Try and you will see.

Start-BitsTransfer

Source path\file: "C:\Folder\Sub[]folder\Folder\File[]name.txt"

Destination path\file: "C:\Folder2\Sub[]folder\Folder\File[]name.txt"

How about now?

I need destination formatted like "C:\Folder2\Sub'[']folder\Folder\File[]name.txt" to successfully transfer it.

Source format should be "C:\Folder\Sub'[']folder\Folder\File'[']name.txt" including file as well.

I have no problem with source because It can be replaced by replace method.
August 19th, 2015 2:11pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics