I'm trying to create shortcut in Windows 7, but after I try and a few google, turn out there is no way in PowerShell.
Question: Is there any other way to batch create shortcut that support unicode path and filename?
Tried using symbolic link, but it's not working (returns file not exist) when a unicode path.
New-Item -ItemType SymbolicLink -Path "C:\f[o]o♭\pr[o]file♭.txt" -Value "C:\b[a]r♭\pr[o]file♭.txt"
Code I used, but didn't work when unicode path, filename.
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($lnkpath)
$Shortcut.TargetPath = $tarpath
$Shortcut.Save()
One of the google search: Create shortcut with Unicode character
Thank you for your prompt reply, then I tried.
$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