簡體   English   中英

在Windows 7上從Ruby執行SoundRecorder.exe

[英]SoundRecorder.exe Executed from Ruby on Windows 7

我正在嘗試從Ruby在Windows 7設備上運行c:\\ windows \\ system32 \\ soundrecorder.exe。 當我運行該應用程序時,出現以下錯誤:“無此文件或目錄”。

我可以成功運行CALC.exe而沒有任何麻煩。

我已驗證我的計算機具有以下文件:

 Directory of c:\windows\system32

07/13/2009  08:39 PM           142,336 SoundRecorder.exe
               1 File(s)        142,336 bytes
               0 Dir(s)  156,940,525,568 bytes free

我正在使用:

@run_command = 'c:\windows\system32\SoundRecorder.exe'
stdin, stdout,stderr =Open3.popen3(@run_command) do |stdin,stdout,stderr,wait_thr|
                        process_pid = wait_thr[:pid]
                        p "Process Started for Execute Command: #{process_pid}"
                        exit_status = wait_thr.value    
            end

這是我嘗試過的事情:

  1. 使用Calc.exe(用於@run_command )運行,它起作用了。
  2. 試圖以失敗的Root特權執行此操作。
  3. 試圖傳遞更多失敗的環境變量。
  4. 試圖通過IRB執行此操作,但失敗了。
  5. 試圖通過失敗的```(回勾)執行此操作。

**其他調試結果***

irb(main):006:0> Dir.exist? 'c:/windows/system32'
=> true

irb(main):011:0> File.exist? 'c:/windows/system32/calc.exe'
=> true

irb(main):012:0> File.exist? 'c:/windows/system32/SoundRecorder.exe'
=> false

HOWEVER before anyone says, "XXX, the file doesn't exist look here"


C:\>dir c:\windows\system32\SoundRecorder.exe
 Volume in drive C is OS
 Volume Serial Number is F099-27F4

 Directory of c:\windows\system32

07/13/2009  08:39 PM           142,336 SoundRecorder.exe
               1 File(s)        142,336 bytes
               0 Dir(s)  156,942,340,096 bytes free

這是Windows問題的100%。

將文件復制到其他任何地方,然后運行它。

有用。 我不知道為什么

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM