[英]powershell find and replace all in one line
I have this line of code which gives me domain\\username. 我有这行代码,它为我提供了域\\用户名。 However, I need to replace the \\ with _.
但是,我需要用_替换\\。 Do I have to do this multiple lines or I can do this in one line?
我必须做多行还是可以在一行中完成?
$UAN = $userProfile["AccountName"].Value
$UAN = $UAN.Replace("/","_")
The above does not work even if it's multiple line. 即使是多行,以上内容也不起作用。
使用- -replace
$UAN = ($userProfile["AccountName"].Value) -replace "\\", "_"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.