$o = $o.Replace("/","\") $pv = $o.Replace("www","uuu")怎么理解


PowerShell交流中心分类: Powershell基础$o = $o.Replace("/","\") $pv = $o.Replace("www","uuu")怎么理解
0
Wintersweet asked 10 年 ago

您好,想问一下
$o = “Logged in users:`n” + (regv “hklm:\software\microsoft\windows nt\currentversion\profilelist” “profileimagepath”)
$o = $o + “`n WLAN Info:`n” + (netsh wlan show all)
$o = $o.Replace(“/”,”\”)
$pv = $o.Replace(“www”,”uuu”)
后两句怎么理解呢?Replace是什么?`n又是什么?谢谢啦
 

0 Answers
1
Mooser Lee 管理员 answered 10 年 ago

后两句怎么理解呢?Replace是字符串替换函数?`n转义的换行符。

PS> $str="www.pstips.net"
PS> $str.Replace('www','9w')
9w.pstips.net

PS> $str.Replace('www',"1`n2`n100w")
1
2
100w.pstips.net