尝试执行该命令:new-item -Path (Resolve-Path -LiteralPath "C:\Users\hittm\Downloads\openhardwaremonitor-v0.9.6\OpenHardwareMonitor\OpenHardwareMonitor.exe") -Name "OHW" -ItemType SymbolicLink
但是得到错误:在这里输入图像描述
在微软的文档中,他们说路径已经是"LiteralPath“了,但是它不起作用。如果我在路径param中执行字符串,则所有操作都很好。
UPD:问题出在错误的参数中,这里有正确的代码:
新产品'C:\Users\hittm\Downloads\openhardwaremonitor-v0.9.6\OpenHardwareMonitor\OpenHardwareMonitor.exe‘-Target -Path .\OHW.lnk -ItemType SymbolicLink
发布于 2022-05-19 07:48:19
问题是参数错误,这是正确的代码:
New-Item -Target 'C:\Users\hittm\Downloads\openhardwaremonitor-v0.9.6\OpenHardwareMonitor\OpenHardwareMonitor.exe' -Path .\OHW.lnk -ItemType SymbolicLink
“need”命令中的参数'-Path‘是用于结果的参数,而设置参数时,我需要使用'-Target’来代替
https://stackoverflow.com/questions/72300355
复制相似问题