Tried this, ran the script as a bat file but does not change the gun mappings. Can you check i have the script correct.
Set-Location -Path "C:\LaunchBox\Emulators\Model3\Config"
#Get-Location
#Find gun1's mouse index
$inputs = & "C:\LaunchBox\Emulators\Model3\Supermodel.exe" -print-inputs
$gun1info = ($inputs | Select-String "mouseGUN1").Line
$gun1index = $gun1info.Substring(1,1)
$gun1formatted = "MOUSE" + $gun1index
Write-Output $gun1formatted
#Find gun2's mouse index
$inputs = & "C:\LaunchBox\Emulators\Model3\Supermodel.exe" -print-inputs
$gun2info = ($inputs | Select-String "mouseGUN2").Line
$gun2index = $gun2info.Substring(1,1)
$gun2formatted = "MOUSE" + $gun2index
Write-Output $gun2formatted
#Read in Supermodel.ini
$content = Get-Content -Path "C:\LaunchBox\Emulators\Model3\Config\Supermodel.ini"
#Edit Supermodel.ini mouse related lines
#This assumes you have one mouse assigned per bind/value already. It will not touch any bindings to the RIGHT of the mouse text
#(Need backtick in front of capture group variable in the replacement else it won't print the value)
#Update gun1
$content = $content -replace '(InputStart1.*?)(MOUSE.*?)(_)',"`$1$gun1formatted`$3"
$content = $content -replace '(InputCoin1.*?)(MOUSE.*?)(_)',"`$1$gun1formatted`$3"
$content = $content -replace '(InputGunX.*?)(MOUSE.*?)(_)',"`$1$gun1formatted`$3"
$content = $content -replace '(InputGunY.*?)(MOUSE.*?)(_)',"`$1$gun1formatted`$3"
$content = $content -replace '(InputTrigger.*?)(MOUSE.*?)(_)',"`$1$gun1formatted`$3"
$content = $content -replace '(InputOffscreen.*?)(MOUSE.*?)(_)',"`$1$gun1formatted`$3"
$content = $content -replace '(InputAnalogGunX.*?)(MOUSE.*?)(_)',"`$1$gun1formatted`$3"
$content = $content -replace '(InputAnalogGunY.*?)(MOUSE.*?)(_)',"`$1$gun1formatted`$3"
$content = $content -replace '(InputAnalogTriggerLeft.*?)(MOUSE.*?)(_)',"`$1$gun1formatted`$3"
$content = $content -replace '(InputAnalogTriggerRight.*?)(MOUSE.*?)(_)',"`$1$gun1formatted`$3"
#Update gun2
$content = $content -replace '(InputStart2.*?)(MOUSE.*?)(_)',"`$1$gun2formatted`$3"
$content = $content -replace '(InputCoin2.*?)(MOUSE.*?)(_)',"`$1$gun2formatted`$3"
$content = $content -replace '(InputGunX2.*?)(MOUSE.*?)(_)',"`$1$gun2formatted`$3"
$content = $content -replace '(InputGunY2.*?)(MOUSE.*?)(_)',"`$1$gun2formatted`$3"
$content = $content -replace '(InputTrigger2.*?)(MOUSE.*?)(_)',"`$1$gun2formatted`$3"
$content = $content -replace '(InputOffscreen2.*?)(MOUSE.*?)(_)',"`$1$gun2formatted`$3"
$content = $content -replace '(InputAnalogGunX2.*?)(MOUSE.*?)(_)',"`$1$gun2formatted`$3"
$content = $content -replace '(InputAnalogGunY2.*?)(MOUSE.*?)(_)',"`$1$gun2formatted`$3"
$content = $content -replace '(InputAnalogTriggerLeft2.*?)(MOUSE.*?)(_)',"`$1$gun2formatted`$3"
$content = $content -replace '(InputAnalogTriggerRight2.*?)(MOUSE.*?)(_)',"`$1$gun2formatted`$3"
#Write new file
#Write-Output $content
$content | Set-Content -Path "C:\LaunchBox\Emulators\Model3\Config\Supermodel.ini"