Method: PSWindows::Exec#get_ip
- Defined in:
- lib/beaker/host/pswindows/exec.rb
#get_ip ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/beaker/host/pswindows/exec.rb', line 44 def get_ip ip = execute("for /f \"tokens=14\" %f in ('ipconfig ^| find \"IP Address\"') do @echo %f", :accept_all_exit_codes => true).strip if ip == '' ip = execute("for /f \"tokens=14\" %f in ('ipconfig ^| find \"IPv4 Address\"') do @echo %f", :accept_all_exit_codes => true).strip end if ip == '' ip = execute("for /f \"tokens=14\" %f in ('ipconfig ^| find \"IPv6 Address\"') do @echo %f").strip end ip end |