⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 01 - managing windows services.rb

📁 O Reilly Ruby Cookbook source code
💻 RB
字号:
require 'rubygems'require 'win32/service'include Win32puts 'Currently Running Services:'Service.services do |svc|  if svc.current_state == 'running'    puts "#{svc.service_name}\t-\t#{svc.display_name}"  endend# Currently Running Services:# ACPI    -       Microsoft ACPI Driver# AcrSch2Svc      -       Acronis Scheduler2 Service# AFD     -       AFD Networking Support Environment# agp440  -       Intel AGP Bus Filter# ...#---Service.exists?('dnscache')                   # => true#---Service.status('dnscache')# => #<struct Struct::Win32ServiceStatus #      service_type="share process", current_state="running", #      controls_accepted=["netbind change", "param change", "stop"], #      win32_exit_code=0, service_specific_exit_code=0, check_point=0,#      wait_hint=0, :interactive?=false, pid=1144, service_flags=0>#---Service.stop('dnscache')Service.status('dnscache').current_state           # => "stopped"Service.start('dnscache')Service.status('dnscache').current_state           # => "running"#---Service.getdisplayname('dnscache')                 # => "DNS Client"Service.getservicename('DNS Client')               # => "dnscache"#---Service.start('foo')Service.pause('foo')Service.resume('foo')Service.stop('foo')  #---Service.status('dnscache').controls_accepted# => ["netbind change", "param change", "stop"]#---

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -