转移excel表 [英] Transfer excel sheet

查看:66
本文介绍了转移excel表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的c#控制台应用程序从位于C:\ Data的excelsheet读取数据,我的c#控制台应用程序可以安装在系统的任何目录中,我的要求是将excelsheet移动到与我的c#相同的位置控制台应用程序,这意味着我不会提供特定的路径移动excelsheet,我不知道如何在File.Move()或代码中指定路径,以便我的应用程序将安装excelsheet应该处理完毕后去那里。

解决方案

从Windows Vista到Windows Vista之间需要知道几个规则地点。事情是一种叫做 UAC 的机制会打扰你。



有几个地方可以访问文件,还有几个地方可以肯定会抛出异常并拒绝你的文件复制/移动/删除命令,除非你的应用程序以提升的权限运行。



所以我的评论中所说的我仍然不喜欢我真的明白你的问题,但我已经看到了足以给你至少这个警告。



干杯!

Eduard

将Excel文件从 C:\ Data \ 移动到可执行文件夹;)



如需了解更多信息,请参阅:应用程序启动和可执行路径 [ ^

My c# console application reads data from a excelsheet which is located at C:\Data and my c# console app can be installed in any directory in the system and my requirement is to move the excelsheet to the same location as my c# console application,so that means i won't be providing path specificly to move the excelsheet and i wan't to know how to specify the path in File.Move() or the code so that whereever my app will be installed the excelsheet should go there after it is processed.

解决方案

Since Windows Vista there are a couple of 'rules' you need to know before transferring files on a windows machine from one to another location. Thing is a mechanism called UAC will bother you.

There are a couple of locations you can access files, and a couple of locations that will surely throw an exception and deny your file copy/move/delete command unless your application is running with elevated permissions.

So as stated in my comments I still don't really understand your question, but I've seen enough to give you at least this warning.

Cheers!
Eduard


Move Excel file from C:\Data\ to executable folder ;)

For further information, please, see: Application Startup and Executable Path[^]


这篇关于转移excel表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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