From: Brian Candler Date: 2007-02-09T01:00:34+09:00 Subject: Re: system (cmd) on windows On Fri, Feb 09, 2007 at 12:51:35AM +0900, Rebhan, Gilbert wrote: > 1. > > system("T:/cvsnt/cvs.exe", "-d > :pserver:username@cvshost:d:/cvsrepos/test co Foobar") > doesn't work, whereas > system("T:/cvsnt/cvs.exe -d :pserver:username@cvshost:d:/cvsrepos/test > co Foobar") > works > > all examples i found had system ("cmd", "args") > is that normal for some executables or is it a buggy behaviour from > cvs.exe ? No, you have to go entirely one way or the other. That is, either split out all the arguments yourself: system("T:/cvsnt/cvs.exe", "-d", ":pserver:username@cvshost:d:/cvsrepos/test", "co", "Foobar") Or pass a single string, as in your second example, in which case the shell will be used to split them. Passing separate arguments is safer against certain forms of attack, and makes it easy to pass arguments which themselves contains spaces or other shell metacharacters. > my rubyscript lies under C:/cvs.rb > my cvsworkspace = T:/cvsworkspace > > now i want to fire my cvs command out of the > cvsworkspace folder > > in a windowshell i would do= > T: > cd workspace > T:/cvsnt/cvs.exe -d :pserver:username@cvshost:d:/cvsrepos/test co Foobar > > how to emulate that with system(...) > i tried to ; separate it : > > system("T:;cd workspace;T:/cvsnt/cvs.exe -d > :pserver:username@cvshost:d:/cvsrepos/test co Foobar") > > but that doesn't work What error does it give? Perhaps you just need system("T:;cd \\workspace; ..." This won't work with the argument-split example given above. In that case you could do it from Ruby, e.g. Dir.chdir("...wherever...") do system("...whatever..") end HTH, Brian.