0_o
0_o

Reputation: 33

PowerShell set literalpath as parameter path

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

Upvotes: 1

Views: 377

Answers (1)

0_o
0_o

Reputation: 33

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

Upvotes: 2

Related Questions