如何在 Windows 上的 Ruby 中寻址 UNC 路径? [英] How do I address a UNC path in Ruby on Windows?
本文介绍了如何在 Windows 上的 Ruby 中寻址 UNC 路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在 Windows 上通过 irb
访问 UNC 共享.在 Windows shell 中它会是
I'm trying to access a UNC share via irb
on Windows. In the Windows shell it would be
\\server\share
我尝试转义所有的反斜杠.
I tried escaping all of the backslashes.
irb(main):016:0> Dir.entries '\\\\server\share'
Errno::ENOENT: No such file or directory - \\server\share
并使用 IP 地址而不是名称
and using the IP address instead of the name
irb(main):017:0> Dir.entries '\\\\192.168.10.1\share'
Errno::ENOENT: No such file or directory - \\192.168.10.1\share
推荐答案
尝试用另一个 '\' 转义 '\'
Try to escape '\' with another '\'
Dir.entries('\\\\\\\\192.168.10.1\\\\share')
这篇关于如何在 Windows 上的 Ruby 中寻址 UNC 路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文