如何为完全限定的文件名添加别名? [英] How can I add an alias name for fully qualified file name?

查看:136
本文介绍了如何为完全限定的文件名添加别名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为文件提供别名路径。但它要求完整路径。可以使用名称作为第一视频而不是完整路径'C:\Documents\downloads\video \ Firstvideo.mp4'?

I am trying to give the alias path for a file. But it is asking for full path.Can use name as 'First video' instead of full path 'C:\Documents\downloads\video\Firstvideo.mp4'?

推荐答案

我读到这里显示的技术直到Windows Vista才可用,但我自己没有测试过。



另外,请记住用户可能已移动此文件夹!
I read that the technique shown here did not become available until Windows Vista, but I have not test that myself.

Also, keep in mind that the user may have moved this folder !
// required
using System.IO;

string uProfilePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
string dwnVideoPath = Path.Combine(uProfilePath, "Downloads\Video");

// does it exist in the "standard location" ?
if (! File.Exists(dwnVideoPath))
{
    MessageBox.Show("Video Download folder not in standard location.");
    return;
}

// test
foreach (string file in Directory.GetFiles(dwnVideoPath))
{
    Console.WriteLine(file);
}


这篇关于如何为完全限定的文件名添加别名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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