简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM