Powershell scripting Discord give an error

Juan Carlos 21 Reputation points
2021-11-02T22:31:57.507+00:00

So the matter is simple, i have design (raw) a ps script to start a few apps (discord and steam). When i launch them apart it seem ok, but together (or other app) it crashes Discord, making it update or somehow blocking it 145931-image.png

So, im not a pro in ps but i want to know the problem to solve it now and in the future.

(The image is reduce because it contains personal folders and info)

Thanks for the help!

145848-image.png

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,354 questions
{count} votes

Accepted answer
  1. Nathan Beaulieu 85 Reputation points
    2023-06-12T22:58:53.2433333+00:00

    I realize this is an older post, but I recently encountered the same problem. Hopefully someone else will find this helpful.

    When you open discord, it's actually launching two executable files: Update.exe and Discord.exe. There seems to be issues with only running Discord.exe, and copying the full path from the shortcut also doesn't work.

    The path for the Discord shortcut is:

    C:\Users\USER\AppData\Local\Discord\Update.exe --processStart Discord.exe

    To get it to work in PowerShell, you have to add the parameter -ArgumentList before "--processStart Discord.exe". Here's the working script (don't forget to change USER to your actual user name)

    Start-Process -FilePath "C:\Users\USER\AppData\Local\Discord\Update.exe" -ArgumentList "--processStart Discord.exe"

    2 people found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. MotoX80 31,561 Reputation points
    2021-11-02T23:09:51.187+00:00

    Without a specific error message, without a script to look at, without an error log to look at, and only a small image that's been cut down to not show much of anything..... why sure, forum users will know exactly what your problem is.

    I'll take an educated guess and suggest that you could add in a delay between each app that you start in order to allow each app time to initialize. Start any database first, then the web/application programs.

    Start-Sleep -Seconds 30
    

    If Discord (whatever that is) still crashes, then search the Discord documentation and find out where it stores it's log files. There should be some error entry in it's log.


  2. Rich Matheisen 44,621 Reputation points
    2021-11-03T01:28:48.31+00:00

    If it crashed there's probably a dump file. Contact the app's support folks and have them look at it. There's probably some sort of race condition, or some developer neglected to lock a shared resource.

    For now, follow the advice @MotoX80 offered and put a small delay between each app's startup. How long that might be depends on what the problem is. You'll probably have to experiment to find the shortest delay that works consistently.


  3. MotoX80 31,561 Reputation points
    2021-11-04T13:08:19.693+00:00

    Another educated guess..... add a WorkingDirectory parameter to the start-process. That way when the processes run, if they try to access a file using an unqualified name like "config.ini" and not a fully qualified name like "C:\Program Files (X86)\Steam\Config.ini" they should be able to find their files.

    Also start Powershell with "Run as administrator".

    Start-Process  "C:\Program Files (X86)\Steam\Steam.exe" -WorkingDirectory "C:\Program Files (X86)\Steam\"
    Start-Sleep -Seconds 10
    Start-Process  "C:\Program Files (X86)\Epic Games\Launcher\Portal\Binaries\Win32\EpicGamesLauncher.exe" -WorkingDirectory "C:\Program Files (X86)\Epic Games\Launcher\Portal\Binaries\Win32"
    Start-Sleep -Seconds 10
    Start-Process  "C:\Program Files (X86)\Jcu\AppDate\Local\Discord\app-1.0.9003\Discord.exe" -WorkingDirectory "C:\Program Files (X86)\Jcu\AppDate\Local\Discord\app-1.0.9003"
    
    0 comments No comments