I want to use scripts to create shortcuts under the Windows operating system (.lnk).
In the Windows environment, I chose PowerShell, wrote the script, successfully created .lnk.
$shell = New-Object -ComObject WScript.Shell
$desktop = [System.Environment]::GetFolderPath('Desktop')
$shortcut = $shell.CreateShortcut("$desktop\clickme.lnk")
$shortcut.TargetPath = "C:\Users\scc\Desktop\linkfolder"
$shortcut.IconLocation = "shell32.dll,004"
$shortcut.Save()
But my online running environment is Linux.
Fortunately, I found that PowerShell in 2016 on a multi-platform transplant, yes, it can support Linux. I found it, downloaded, and installed. Under Linux, in the PowerShell command window I can run some basic commands.
There was a run-time error! When I run the first line of code:
$shell = New-Object -ComObject WScript.Shell
The error message is:
New-Object : Unable to load DLL 'api-ms-win-core-com-l1-1-0.dll': The specified module or one of its dependencies could not be found. (Exception from HRESULT: 0x8007007E) At line:1 char:10 + $shell = New-Object -ComObject WScript.Shell + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [New-Object], DllNotFoundException + FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.NewObjectCommand
According to the prompt, it seems that the lack of WScript-related modules. Missing DLL file.
My requirement is to run Java programs under Linux to create shortcuts in Windows format. (Stored in the network disk, the file system for the btrfs, and can provide SMB \ AFP \ NFS \ FTP these file services)
Yes, this demand seems to be strange, if you have a new solution ideas and ideas, please tell me or discuss with me.
I have a bold idea: can I use the SMB protocol to create an .lnk file?