Solved trying to create a shortcut


bonky

Member
Local time
2:06 PM
Posts
24
OS
win10
Hi All

I'm trying to create a short cut via CMD

The App
explorer.exe shell:appsFolder\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe!App

The Command
if exist "C:\Program Files\WindowsApps\Microsoft.MicrosoftStickyNotes*" powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%USERPROFILE%\Desktop\Test.lnk');$s.WorkingDirectory='C:\Windows\system32';$s.TargetPath='explorer.exe shell:appsFolder\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe!App';$s.Save()"

But its failing.... I suspect its not liking the ':' can anyone help in a work around?

The Error
Value does not fall within the expected range.
At line:1 char:128
+ ... s\system32';$s.TargetPath='explorer.exe shell:appsFolder\Microsoft.Mi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException
 

My Computer

System One

  • OS
    win10
    Computer type
    PC/Desktop
That's a convaluted way of trying to do it.
All you have to do is is go to start menu, find sticky notes in all apps list, drag it to desktop, or right click on it in start menu and select pin to start or pin to taskbar
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 25H2 26200.8655
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 7080
    CPU
    i9-10900 10 core 20 threads
    Motherboard
    DELL 0J37VM
    Memory
    32 gb
    Graphics Card(s)
    none-Intel UHD Graphics 630
    Sound Card
    Integrated Realtek
    Monitor(s) Displays
    Benq 27
    Screen Resolution
    2560x1440
    Hard Drives
    2x1tb Solidigm m.2 nvme /External drives 512gb Samsung m.2 sata+2tb Kingston m2.nvme
    PSU
    500w
    Case
    MT
    Cooling
    Dell Premium
    Keyboard
    Logitech wired
    Mouse
    Logitech wireless
    Internet Speed
    so slow I'm too embarrassed to tell
    Browser
    #1 Edge #2 Firefox
    Antivirus
    Defender+MWB Premium
  • Operating System
    Windows 11 Pro 24H2 26200.8457
    Computer type
    PC/Desktop
    Manufacturer/Model
    Beelink Mini PC SER5
    CPU
    AMD Ryzen 7 6800U
    Memory
    32 gb
    Graphics card(s)
    integrated
    Sound Card
    integrated
    Monitor(s) Displays
    Benq 27
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Crucial nvme
    Keyboard
    Logitech wired
    Mouse
    Logitech wireless
    Internet Speed
    still too embarrassed to tell
    Browser
    Firefox
    Antivirus
    Defender
    Other Info
    System 3 is non compliant Dell 9020 i7-4770/24gb ram Win11 PRO 26200.8457
That's a convaluted way of trying to do it.
All you have to do is is go to start menu, find sticky notes in all apps list, drag it to desktop, or right click on it in start menu and select pin to start or pin to taskbar
Thank you... but im running a script to perform this
 

My Computer

System One

  • OS
    win10
    Computer type
    PC/Desktop
I'm actually confused by the simple solution.
PS on your command line is treating the ":" in "shell:appsFolder" like $variable:specifier

Wrapping only the "shell:appsFolder" string in double-quotes, and dropping the other double-quotes surrounding the entire command line appears to work fine.
Code:
if exist "C:\Program Files\WindowsApps\Microsoft.MicrosoftStickyNotes*" powershell $s=(New-Object -COM WScript.Shell).CreateShortcut('%USERPROFILE%\Desktop\Test.lnk');$s.WorkingDirectory='C:\Windows\system32';$s.TargetPath="explorer.exe shell:appsFolder\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe!App";$s.Save()

Sometimes mixing CMD and PS on the same command line leads to bizarre variable expansion errors. :think:
 

My Computer

System One

  • OS
    Windows 7
if exist "C:\Program Files\WindowsApps\Microsoft.MicrosoftStickyNotes*" powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%USERPROFILE%\Desktop\Test.lnk');$s.WorkingDirectory='C:\Windows\system32';$s.TargetPath='explorer.exe';$s.Arguments='shell:appsFolder\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe!App';$s.Save()"
 

My Computer

System One

  • OS
    Windows 10 Home
    Computer type
    Laptop
    Manufacturer/Model
    HP Elitebook 2530p
    CPU
    Intel Core 2 Duo [email protected] GHz
    Memory
    2 GB
if exist "C:\Program Files\WindowsApps\Microsoft.MicrosoftStickyNotes*" powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%USERPROFILE%\Desktop\Test.lnk');$s.WorkingDirectory='C:\Windows\system32';$s.TargetPath='explorer.exe';$s.Arguments='shell:appsFolder\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe!App';$s.Save()"
Thank you!!
 

My Computer

System One

  • OS
    win10
    Computer type
    PC/Desktop
That's a convaluted way of trying to do it.
All you have to do is is go to start menu, find sticky notes in all apps list, drag it to desktop, or right click on it in start menu and select pin to start or pin to taskbar
if you can help me copy the link from the apps folder to the desktop.... id be all ears
 

My Computer

System One

  • OS
    win10
    Computer type
    PC/Desktop
if you can help me copy the link from the apps folder to the desktop.... id be all ears
Are you saying that Sticky Notes is NOT in the start menu all apps list.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 25H2 26200.8655
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 7080
    CPU
    i9-10900 10 core 20 threads
    Motherboard
    DELL 0J37VM
    Memory
    32 gb
    Graphics Card(s)
    none-Intel UHD Graphics 630
    Sound Card
    Integrated Realtek
    Monitor(s) Displays
    Benq 27
    Screen Resolution
    2560x1440
    Hard Drives
    2x1tb Solidigm m.2 nvme /External drives 512gb Samsung m.2 sata+2tb Kingston m2.nvme
    PSU
    500w
    Case
    MT
    Cooling
    Dell Premium
    Keyboard
    Logitech wired
    Mouse
    Logitech wireless
    Internet Speed
    so slow I'm too embarrassed to tell
    Browser
    #1 Edge #2 Firefox
    Antivirus
    Defender+MWB Premium
  • Operating System
    Windows 11 Pro 24H2 26200.8457
    Computer type
    PC/Desktop
    Manufacturer/Model
    Beelink Mini PC SER5
    CPU
    AMD Ryzen 7 6800U
    Memory
    32 gb
    Graphics card(s)
    integrated
    Sound Card
    integrated
    Monitor(s) Displays
    Benq 27
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Crucial nvme
    Keyboard
    Logitech wired
    Mouse
    Logitech wireless
    Internet Speed
    still too embarrassed to tell
    Browser
    Firefox
    Antivirus
    Defender
    Other Info
    System 3 is non compliant Dell 9020 i7-4770/24gb ram Win11 PRO 26200.8457

Latest Support Threads

Back
Top Bottom