I\'m trying to open a new command window in a BAT file:
start %windir%\\system32\\cmd.exe
After it opens, I\'d like to execute a BAT comman
Thanks to all here in Stack Overflow; this solution solves the above question but is extended to automatically run these tasks:
I guess my project is called "antiquorum."
Create an "init.bat" file in your %USERPROFILE% directory (open a cmd window and take a look at the path to the left of the cursor to know what %USERPROFILE% is)
@echo off
cd C:/projects/rails3/antiquorum
if "%1" == "antiquorum" GOTO start
if "%1" == "worker" GOTO worker
if "%1" == "server" GOTO server
if "%1" == "" GOTO end
:start
start cmd /k %USERPROFILE%\init.bat worker
start cmd /k %USERPROFILE%\init.bat server
TIMEOUT 30
start "" "http://localhost:3000/"
GOTO end
:server
rails s
GOTO end
:worker
rake jobs:work
:end
In a new command line window type: C:> init antiquorum
The code opens two more cmd windows and a browser. TIMEOUT avoids errors in the browser.
The :start section does the work. You can run tasks 1,2 or 4 separately by typing params as: server, worker, or none to leave a cmd opened in root of "antiquorum" project.
Enjoy.