0

I'm trying to create a Windows shortcut that will be put in my startup folder. The shortcut starts a program (Discord), but with a 1-minute delay. I'm doing this because my (ancient) core i3-2100 PC that I forced to run Windows 11 Pro gets laggy when there are a bunch of programs that open during startup. My custom shortcut will minimalize the lag. The shortcut opens Windows Powershell and runs a command, but I'm having trouble typing the full path (that has some parameters) in the Target box from the shortcut's properties due to the character limit.

This what I'm trying to type into the Target box: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -Command "Start-Sleep -Seconds 60 ; Start-Process 'C:\Users\User\AppData\Local\Discord\Update.exe' -ArgumentList '--processStart Discord.exe', '--process-start-args --start-minimized'"

I've tried to bypass the character limit by:

  • Enabling Win32 long paths via Local Group Policy Editor
  • Setting LongPathsEnabled to 1 via Registry Editor

Unfortunately, all of those methods didn't work.

Is there something I'm missing or should I consider creating a VBS or batch file instead?

7
  • 1
    Just fyi: This isn’t a path, it’s a command (that contains a rather short path). It isn't subject to the Win32 path limit either way, because you’re creating a shell link, not calling a Win32 function. // Maybe create a script file instead, and see if that will help.
    – Daniel B
    Commented Jun 22 at 13:48
  • LongPathsEnabled does not apply to shortcuts. File Explorer which shortcuts are a part of does NOT support paths longer than 255 characters. As others have suggested that also isn’t a path.
    – Ramhound
    Commented Jun 22 at 13:53
  • @Ramhound Thanks, I will consider creating a script file
    – Mik
    Commented Jun 22 at 13:56
  • Given that powershell is by default in a location in your path, you can remove the path from powershell and just use powershell ... instead, making it a lot shorter. If you make it start where your discord is, you can also remove the path for discord too.
    – LPChip
    Commented Jun 22 at 13:59
  • @LPChip I replaced the full path with just "powershell" but it turned into C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe by itself and cut the string. Typing "cmd" has similar results; it turns into the full path.
    – Mik
    Commented Jun 22 at 14:06

1 Answer 1

0
cmd.exe /C "PING.EXE 127.0.0.1 -n 60 -w 1000 > NUL && "C:\Users\User\AppData\Local\Discord\Update.exe --processStart Discord.exe""

In the shortcut properties, tell it to start the shortcut Minimized. See this screenshot.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .