Trying execute that command:
new-item -Path (Resolve-Path -LiteralPath "C:\Users\hittm\Downloads\openhardwaremonitor-v0.9.6\OpenHardwareMonitor\OpenHardwareMonitor.exe") -Name "OHW" -ItemType SymbolicLink
But getting error: enter image description here
In Microsoft docs they said that path is already "LiteralPath" but it not work. If i truing execute string in path param all works fine.
UPD: Problem is in wrong parameter here's correct code:
New-Item -Target 'C:\Users\hittm\Downloads\openhardwaremonitor-v0.9.6\OpenHardwareMonitor\OpenHardwareMonitor.exe' -Path .\OHW.lnk -ItemType SymbolicLink
CodePudding user response:
Problem is in wrong parameter here's correct code:
New-Item -Target 'C:\Users\hittm\Downloads\openhardwaremonitor-v0.9.6\OpenHardwareMonitor\OpenHardwareMonitor.exe' -Path .\OHW.lnk -ItemType SymbolicLink
Parameter '-Path' in 'New-Item' command is parameter for result, for setting parameter to work with i need to use '-Target' instead