Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Running a server in background using cmd shell for Windows

I am trying to run a file called CoreServer.exe in background using cmd shell as mentioned here. When I specify the path of the server, it tells me,

'.' is not recognized as an internal or external command,
operable program or batch file.

On the other hand if I remove shell: cmd it works fine. But in this case it runs using Poweshell and I don’t want that because running in Powershell is not what I want.

Here is my workflow file. I also have this in a public repo on GitHub here.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

name: Test unit tests CI

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

  
jobs:
  build:

    runs-on: windows-2022

    steps:
    - uses: actions/checkout@v3

    - name: setup Msbuild
      uses: microsoft/setup-msbuild@v1.3.1
      

#try nc -v -N 127.0.0.1 3334
 #curl http://localhost:3333 -I
 #vstest.console.exe ./Pico/Medman/FluidTransferTests/bin/Release/net481/FluidTransferTests.dll
#Start CoreServer.exe in background
    
    - name: Start CoreServer.exe in the background
      shell: cmd
      run: ./Debug/CoreServer.exe -c -s &

    - name: Wait 7 seconds
      run: sleep 7

    - name: See status
      run: netstat -ntp

To add more information, when I run this CoreServer.exe in a command prompt on my local it runs fine and shows the following,

CoreServer.exe -c -s

>Solution :

The windows shell doesn’t handle linux style path separators. ./debug must be .\debug, that will remove the error.

    - name: Start CoreServer.exe in the background
      shell: cmd
      run: .\Debug\CoreServer.exe -c -s &
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading