Is it possible to setup a script like this:
file.exe [CMD(POWERSHELL(CMD))]
Here's my code as of now, (combined from answers I've got here):
:RETURN
powershell -command "Start-Process -FilePath '\\my\file\path\myapplication.exe'"
powershell -command "if (gps | ? {$_.mainwindowtitle} | select name, id, mainwindowtitle | where {$_.Name -match 'myapplication'}) { Write-Output 'App verified, running in Taskbar.'} else { Write-Output 'App no running in Taskbar, checking again.' cmd.exe /c 'GOTO RETURN' }"
The above batch file has been converted into a .exe.
My main problem is cmd.exe /c 'GOTO RETURN'
is being read as Write-Output
instead of a code.