Jump to content

DCS and "multiple-com-ports" command file...anyway to make a Batch file to start it all?


Recommended Posts

Posted

Hi,

I am trying to create a window batch file to start up, in sequence TrackIR, VoiceAttack, "Multiple-com-ports" command file and then DCS. I can get it to work fine for TrackIR, VoiceAttack and DCS itself, but my attempts to included the "Multiple-com-ports" command file have been fruitless.

Any ideas?


Mike

Posted (edited)

Hello Mike you got me thinking I do spend a bit of time launching all these programs individually in support of DCS a batch file would is not be a bad idea. That said on Monday I got on it and found that it would be better to use powershell. Since Multiple Com Port is a cmd file its script is different then normal .exe files maybe why you are having issues. Let me add if one of those .exe files need higher authority then that script will be slightly different from the .exe files also.

In power shell this is what my launch-multiple-com-ports.ps1 file looked like. I made it into an icon that when clicked it launch the program and I intergrated it into streamdeck as a push button:

# Path to your CMD file
$cmdPath = "C:\Users\jpav2\Saved games\DCS\Scripts\Programs\multiple-com-ports.cmd"

# Working directory for the CMD file
$workingDir = Split-Path -Path $cmdPath

# Launch in classic Command Prompt, keep window open
Start-Process -FilePath "cmd.exe" `
    -ArgumentList "/k `"$cmdPath`"" `
    -WorkingDirectory $workingDir

If the cmd program hangs instead of searching {alt\tab} for that window then mouse to click close and then look for and relaunch program and finally back to the game. I created another script to close the crashed cmd window which allows me to relaunch it again. Both are desktop icon and on stream so now the process is press a button, thats it. 

To close here is the powershell script - close-multiple-com-ports.ps1:

 Get-Process -Name OpenConsole -ErrorAction SilentlyContinue | ForEach-Object {
    try { $_.Kill() }
    catch { Write-Host "Failed to kill OpenConsole process: $_" }
}

Notice I had to use OpenConsole to close the Multiple Com Port window. Powershell had issue closing the crashed cmd window initially and my understanding is it is looking to close the cmd window. I guess when it crashes it is no longer functioning as a cmd file so the work around was close any OpenConsole which is what it becomes after it crashes. Control Alt delete task manager reveals that. I created the close one because I get a bit of socat crashes on that Multiple Com Port program because Elgato streamdeck and BIOS stuff, for example Tex Creation IFEI do not play nice together, at least I can not figure it out on my pit : )

Hit me up if you need help

Cheers

J

Edited by Dos
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...