Run a exe in c:\windows\system32 from ruby


#1

Hello,

I would like to run msc command, but it seem impossible with MRI Ruby ( 2.3.3).

d:\>diskmgmt.msc                                         # ok
d:\>ruby -e "spawn('diskmgmt.msc')"            # error   : e:1:in `spawn': No such file or directory - diskmgmt.msc                                                                         
                                                                                                                                                                 
d:\>ruby -e "pid=Process.spawn('ruby -v'); Process.wait(pid) "                     # ok                                                                
ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]                                                                                                        
                                                                                                                                                             
d:\>ruby -e "pid=Process.spawn('C:/WINDOWS/system32/mmc.exe'); Process.wait(pid) "             "nok                                  
-e:1:in `spawn': Invalid argument - C:/WINDOWS/system32/mmc.exe (Errno::EINVAL)                              

It is not only mmc.exe which not work, it seem to be all commands in /windows/system32


d:\>C:/windows/system32/msconfig.exe       # ok
d:>ruby -e "pid=Process.spawn('C:/windows/system32/msconfig.exe'); Process.wait(pid) "                                                            
-e:1:in `spawn': No such file or directory - C:/windows/system32/msconfig.exe (Errno::ENOENT)                                                                    
        from -e:1:in `<main>'