桌面文件保存D盘 [英] Desktop File Save D Drive

查看:59
本文介绍了桌面文件保存D盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我想在桌面上创建此文件时将我的Destop文件保存到D盘。

请帮助我。我如何改变Destop路径。







我使用你的代码和工作正常。



但是如果我创建一个新文本文件或从d驱动器复制文件并粘贴在保留此位置的桌面上C:\ Users \ EITL \Desktop但是我想要更改此位置D:\\BackUp。

Hi I want to save my Destop File to D Drive when create this file in desktop.
Please Anybody Help me . How I Change Destop Path.



I have use Your Code And Work Fine.

But if I crete a new text file or Copy a file from d drive and paste on the Desktop That Remain This Location C:\Users\EITL\Desktop But I Want Change This Location D:\\BackUp.

推荐答案

桌面是一个文件夹 - 您无法将文件保存在D:驱动器上并期望它也可以在桌面上显示。

您可以非常轻松地获得桌面路径:

The Desktop is a folder - you can't save the file on the D: drive and expect it to appear on the desktop as well.
You can get the path to the desktop pretty easily:
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);



但是如果你想在桌面上创建一个快捷方式到你的文件在D:驱动器:


But if you want to create a shortcut on the desktop to your file on the D: drive:

string actualFilePath = @"D:\Temp\MyPic.jpg";
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
File.WriteAllText(path + @"\My Short Cut.url", string.Format("[InternetShortCut]\nURL={0}\n", actualFilePath));

应该这样做。


这篇关于桌面文件保存D盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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