From: Bill Guindon Date: 2006-03-08T08:03:33+09:00 Subject: Re: Running windows shell command On 3/7/06, dfaroi@gmail.com wrote: > Hi all, > > Sorry for my english, I'm french. It's better than my french ;) > I have some problem running an xcopy command with paths that contains > spaces. > I'm trying that : > output = `cmd /c xcopy /r /y \"C:/Test A\" \"C:/Test B\"` As logan mentioned, you don't need to escape the double quotes. You also don't need to call 'cmd /c', but you certainly can if you like. I think that using it might actually hide the error, since you're now getting the result of running 'cmd' and not of running 'xcopy'. I _think_ the problem is the use of the '/' as the path separator. I ran a few tests here, and it seems that can be interpreted by cmd as a paramater flag (just as you are using the /c /r and /y flags). So try changing the slash to backslash (which does need to be escaped) like this: output = `xcopy /r /y "C:\\Test A" "C:\\Test B"` > Xcopy doesn't return any error but don't transfer files from "Test A" > to "Test B". > If I rename those paths without spaces and double quotes, it works : > output = `cmd /c xcopy /r /y C:/TestA C:/Test B` > > Could someone can explain this issue ? > Or can tell me a better way to do fast copy files under Windows and get > back a list of files tha was transfered ? > > Copying files with ruby is less faster than running an xcopy command. > Is it always true ? > > Thanks all for you're help to a french guy ;) > > David > > > -- Bill Guindon (aka aGorilla) The best answer to most questions is "it depends".