如何在vb.net中更改应用程序启动路径? [英] How to change application start up path in vb.net?

查看:196
本文介绍了如何在vb.net中更改应用程序启动路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改vb.net(基于窗口的应用程序)应用程序启动路径?

解决方案

(Windows中的启动文件夹实际上是一个开始菜单文件夹,Windows从登录后启动应用程序 - 但我很确定你没有意味着这个......)



含义启动路径是:应用程序启动的路径 - 而不是可执行文件本身的路径。从命令提示符启动应用程序时,它是当前路径。



好​​的,现在不要试图落后于问题的ninsensic方面 - 你可以'更改此项(移动文件本身除外),您可以从一个或另一个路径开始。但是你可以影响工作目录。



1)您可以更改应用程序工作目录:https://msdn.microsoft.com/en-us/library/system.io.directory.setcurrentdirectory(v=vs.110 ).aspx [ ^ ]



2)如果您从代码启动应用程序,则可以指定工作方向:https://msdn.microsoft.com/en-us/ library / system.diagnostics.processstartinfo.workingdirectory%28v = vs.110%29.aspx [ ^ ]



3)快捷方式/ Shell链接(.lnk)具有转换启动目录的属性,但这也是最初的worikg目录。例如,你可以使用这个(也来自VB.NET):创建和解析shell链接 [ ^

How can i change the vb.net ( Window Based Application ) application start up path?

解决方案

(Startup folder in Windows is actually a Start menu folder, from where Windows starts applications after logon - but I am pretty sure you haven't meant this one...)

The meaning of startup path is: the path from where the application is started - and not the path of the executable itself. When you start the application from command prompt it is the current path.

Ok, now le't try to get behind the ninsensic aspect of the question - you can't change this (except of moving the file itself), you either start from one path or another. But you can influence working directory.

1) You can change application working directory: https://msdn.microsoft.com/en-us/library/system.io.directory.setcurrentdirectory(v=vs.110).aspx[^]

2) If you start the app from code, you can specify working directry: https://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.workingdirectory%28v=vs.110%29.aspx[^]

3) Shortcuts/Shell links (.lnk) have a property that is translated startup directory, but that is also the initial worikg directory. You can use this one for example (also from VB.NET): Creating and Resolving shell links[^]


这篇关于如何在vb.net中更改应用程序启动路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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