Hey guys, I have a shortcut with the following target:
%LOCALAPPDATA%\NirSoft\ControlMyMonitor\ControlMyMonitor.exe /LoadConfig "%LOCALAPPDATA%\NirSoft\ControlMyMonitor\Configs\Cinema.cfg" Primary
However, when using WScript.Shell to obtain the link properties, I see;
PS C:\Users\Fots> $wshShell = New-Object -ComObject WScript.Shell
PS C:\Users\Fots> $wshShell.CreateShortcut('C:\Users\Fots\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\NirSoft\ControlMyMonitor Cinema.lnk')
FullName : C:\Users\Fots\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\NirSoft\ControlMyMonitor Cinema.lnk
Arguments : /LoadConfig "%LOCALAPPDATA%\NirSoft\ControlMyMonitor\Configs\Cinema.cfg" Primary
Description :
Hotkey : Alt+Ctrl+3
IconLocation : ,0
RelativePath :
TargetPath : C:\Users\Fots\AppData\Local\NirSoft\ControlMyMonitor\ControlMyMonitor.exe
WindowStyle : 1
WorkingDirectory :
Notice that the TargetPath has had %LOCALAPPDATA% expanded to the directory.
Is there a way to obtain the TargetPath without expanding environment variables? (i.e. TargetPath should be %LOCALAPPDATA%\NirSoft\ControlMyMonitor\ControlMyMonitor.exe)
Huge thanks in advance!!
Fotis