I’m new to Ruby, so this may be a pretty basic question.
I have a Windows batch file that I use all the time to interface with my source control system . The batch file issues various command-line commands supported by the source control system’s command line interface (CLI).
I’d like to write a Ruby program that issues some of these commands. In general, how do you issue command-line commands from a Ruby program on Windows?
Thanks!
to run a system (command line) command in ruby wrap it with `
for example
will run the
cmdwindowdircommandif you need the return value (
ERRORLEVEL) you can use thesystemcommandfor example
system("dir")which return atruefor success andfalsefor failure theERRORLEVELvalue is stored at$?