0
我试图在Windows 7中创建快捷方式,但在尝试和几个google之后,发现PowerShell中没有办法。创建包含unicode路径的快捷方式
问:是否有其他方式批量创建支持unicode路径和文件名的快捷方式?
尝试使用符号链接,但它不起作用(返回文件不存在)当一个unicode路径。
New-Item -ItemType SymbolicLink -Path "C:\f[o]o♭\pr[o]file♭.txt" -Value "C:\b[a]r♭\pr[o]file♭.txt"
我使用过的代码,但在unicode路径,文件名时不起作用。
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($lnkpath)
$Shortcut.TargetPath = $tarpath
$Shortcut.Save()
一个谷歌搜索的: Create shortcut with Unicode character
感谢您的及时回复,然后我试过了。
$tarpath = "C:\f[o]o♭\pr[o]file♭.txt"
$lnkpath = "C:\b[a]r♭\pr[o]file♭.txt"
$tarpath = $tarpath.Replace('[','`[')
$tarpath = $tarpath.Replace(']','`]')
$lnkpath = $lnkpath.Replace('[','`[')
$lnkpath = $lnkpath.Replace(']','`]'
# echo print $tarpath like this -> C:\b`[a`]r♭\pr`[o`]file♭.txt,
# but I'm not sure when it is the same at -Path $tarpath
New-Item -ItemType SymbolicLink -Path $tarpath -Value $lnkpath
你需要逃避'['和']':''' - 路径C:\ F'【O '] o♭\ pr' [o'] file♭.txt''' –
感谢您的及时回复,然后我尝试了。 $ tarpath =“C:\ f [o] o♭\ pr [o] file♭.txt” $ lnkpath =“C:\ b [a]r♭\ pr [o] file♭.txt” $ tarpath = $ tarpath.replace( '[', ''[') $ tarpath = $ tarpath.replace( ']', '']') $ lnkpath = $ lnkpath.replace( '[',” '[') $ lnkpath = $ lnkpath.replace(']','']') echo print like this - >''C:\ b' [a']r♭\ pr' [o']文件♭.txt'',但我不知道什么时候它是相同的在路径$ tarpath 新项目-ItemType SymbolicLink-路径$ tarpath -Value $ lnkpath – Foolenko
评论中的反斜杠是一个噩梦, (http://stackoverflow.com/posts/43306251/edit)你的问题,而不是:-) –