You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting up a script under Windows (a .bat or .ps1 script, e.g. C:\test.bat) to run before a game is launched does not work, preventing the game from launching without any usable feedback or log entry.
Cause
child_process.spawn(scriptPath, ...) (see here) does not launch a script file under Windows directly.
Instead one would have to invoke the script interpreter and pass the script as an argument e.g. child_process.spawn('cmd', ['/c', scriptPath]).
Solution
Either:
add an option for script arguments, child_process.spawn(scriptPath, scriptArguments)
e.g. child_process.spawn('cmd', ['/c', 'C:\\test.bat'])
use child_process.exec(scripPath) instead, e.g. child_process.exec('cmd /c C:\\test.bat')
Add logs
Launching "<game name>" (legendary)
Native? Yes
Installed in: <game path>
System Info:
...
OS: Microsoft Windows 10 Education N 10.0.19045 (win32)
The current system is not a Steam Deck
We are not running inside a Flatpak container
Software Versions:
Heroic: 2.15.2 Emeth
Legendary: 0.20.36 Urban Flight (Heroic)
gogdl: 1.1.2
comet: comet 0.1.2
Nile: 1.1.2 Will A. Zeppeli
Game Settings: {
...
"beforeLaunchScriptPath": "C:\\test.bat",
"afterLaunchScriptPath": ""
}
Game launched at: <time>
Steps to reproduce
Under Windows in Heroic:
Right click any game
Click on Settings
Under "Scripts: Select a script to run before the game is launched" enter or select a .bat or .ps1 script
Close settings window
Launch the game
Game does not launch, Status is stuck at "Launching"
Expected behavior
Script and game is run by Heroic
Heroic Version
Latest Stable
System Information
OS: Windows 10
Heroic: 2.15.2
Additional information
Running e.g. a compiled AutoHotkey script does also not work, since Heroic waits for the script to close, which a hotkey script does obviously not do.
The text was updated successfully, but these errors were encountered:
Describe the bug
Setting up a script under Windows (a
.bat
or.ps1
script, e.g.C:\test.bat
) to run before a game is launched does not work, preventing the game from launching without any usable feedback or log entry.Cause
child_process.spawn(scriptPath, ...)
(see here) does not launch a script file under Windows directly.Instead one would have to invoke the script interpreter and pass the script as an argument e.g.
child_process.spawn('cmd', ['/c', scriptPath])
.Solution
Either:
child_process.spawn(scriptPath, scriptArguments)
e.g.
child_process.spawn('cmd', ['/c', 'C:\\test.bat'])
child_process.exec(scripPath)
instead, e.g.child_process.exec('cmd /c C:\\test.bat')
Add logs
Steps to reproduce
Under Windows in Heroic:
.bat
or.ps1
scriptExpected behavior
Script and game is run by Heroic
Heroic Version
Latest Stable
System Information
Additional information
Running e.g. a compiled AutoHotkey script does also not work, since Heroic waits for the script to close, which a hotkey script does obviously not do.
The text was updated successfully, but these errors were encountered: