Hello. this system command works from the command prompt but not from
irb. when i have a space in the directory name, the irb system command
cannot take it.
irb(main):008:0> system(“dir e:\program files”)
Volume in drive E has no label.
Volume Serial Number is N857-EB60
Directory of e:\
File Not Found
Directory of E:\Documents and Settings\rocky
File Not Found
=> false
When i try this thro command prompt, it works
E:\Documents and Settings\rocky>dir “e:\program files”
Volume in drive E has no label.
Volume Serial Number is B857-EB62
However as you said dir is an internal command and forward slash breaks
with
it on the windows command line, but it does work in irb and stand-alone
ruby.
irb(main):001:0> system(‘dir “d:/program files”’)
Volume in drive D is WINDOWS
Volume Serial Number is 847A-A69A
Directory of d:\program files
13/01/2008 05:21 PM .
13/01/2008 05:21 PM …
13/01/2008 05:30 PM Cakewalk
24/10/2007 12:04 AM Common Files
24/10/2007 12:03 AM ComPlus Applications
10/11/2007 11:11 PM DAEMON Tools
03/01/2008 05:12 PM DIFX
24/10/2007 12:48 AM Internet Explorer
04/01/2008 09:28 AM Java
24/10/2007 12:19 AM Messenger
24/10/2007 12:36 AM MSBuild
24/10/2007 12:40 AM MSXML 6.0
24/10/2007 12:31 AM Reference Assemblies
12/12/2007 09:03 PM TortoiseSVN
02/11/2007 04:09 PM vim71
24/10/2007 12:03 AM Windows NT
0 File(s) 0 bytes
18 Dir(s) 5,931,704,320 bytes free
=> true
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.