访问文件使用pc名称 [英] access to files use pc name

查看:85
本文介绍了访问文件使用pc名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨我的朋友

i使用此代码访问我的图片但它给我错误

i应该访问他们使用计算机名

fileInDir = Directory.GetFilles(\\PARISA-PC \\ C:OMEGA \\KAJ,* .Bmp,SearchOption.TopDirectoryOnly);

请帮帮我

hi my friends
i use this code for access to my image but it give me error
i should access to them use computer name
fileInDir = Directory.GetFilles("\\PARISA-PC\\C:OMEGA\\KAJ", "*.Bmp", SearchOption.TopDirectoryOnly);
please help me

推荐答案

你不能像你一样表达UNC路径;你必须转义反斜杠(或者用@来声明字符串)。正确的路径是:

You cannnot express an UNC path like you did; and you have to escape backslashes (or put an @ to declare the string). The correct path is:
fileInDir = Directory.GetFilles(@"\\PARISA-PC\C


\OMEGA\KAJ, * .Bmp,SearchOption.TopDirectoryOnly);
\OMEGA\KAJ", "*.Bmp", SearchOption.TopDirectoryOnly);



或者,没有@:


Or, without @:

fileInDir = Directory.GetFilles("\\\\PARISA-PC\\C


\\OMEGA\\KAJ, *。Bmp,SearchOption.TopDirectoryOnly);
\\OMEGA\\KAJ", "*.Bmp", SearchOption.TopDirectoryOnly);


这篇关于访问文件使用pc名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆