Home > Blockchain >  Run Shiny App from command line with custom port
Run Shiny App from command line with custom port

Time:12-21

I am trying to run a Shiny app using a .bat file with custom port. Here is what I have :

test.bat:

d:
cd "C:\Users\directory"
R -e "options(shiny.port = 5242)"
start "prog1" R -e "shiny::runApp()"
start "prog2" "C:\Program Files\Google\Chrome\Application\chrome.exe" "http://localhost:5242"

The fact is that executing :

> options(shiny.port = 5242)
> shiny::runApp()

works from the RStudio console. But when I try this from the cmd, it doesn't opens the app without applying the port to the app.

Any idea?

CodePudding user response:

The solution :

d:
cd "C:\Users\directory"
start "prog1" R -e "options(shiny.port=5242);shiny::runApp()"
start "prog2" "C:\Program Files\Google\Chrome\Application\chrome.exe" "http://localhost:5242"
  • Related