简体   繁体   English

如何在Windows应用程序(.net)中启动

[英]How to work with startup in windows application(.net)

i created a small tool in windows application using (.net language C#). 我使用(.net语言C#)在Windows应用程序中创建了一个小工具。 i created setup for my tool and also when we click on minimize button it will be in system tray. 我为我的工具创建了设置程序,当我们单击最小化按钮时,它也会出现在系统托盘中。 My requirement is i want to place my tool in start up (start>All Programs>Start up) when i start my system automatically my tool is open this is my requirement please help me thank you. 我的要求是我想在自动启动系统时将工具置于启动状态(启动>所有程序>启动),这是我的要求,请帮助我。

转到解决方案资源管理器并选择您创建的设置文件夹,选择任何文件(项目设置),您会看到两个分割的窗口,一个是目标计算机上的文件系统,右键单击空白空间,您可以得到“添加特殊文件夹>>用户启动”文件夹”,您可以得到一个文件夹,然后右键单击并添加所有项目输出。

Just put the EXE you want to run to the correct startup folder. 只需将要运行的EXE放到正确的启动文件夹中即可。 Username is the logged on user. 用户名是登录的用户。 Run cmd, then type echo %username% to find your username. 运行cmd,然后键入echo %username%来找到您的用户名。

Windows Vista

c:\Users\[username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Windows XP/2000

c:\Documents and Settings\[username]\Start Menu\Programs\Startup

Windows NT 4

c:\Winnt\Profiles\[username]\Start Menu\Programs\Startup

Windows 95/98/ME

c:\WINDOWS\Start Menu\Programs\Startup

The cleaner way is to copy the exe to the following location 较干净的方法是将exe复制到以下位置

Environment.GetFolderPath(System.Environment.SpecialFolder.Startup) Environment.GetFolderPath(System.Environment.SpecialFolder.Startup)

The only reason I recommend using this Method instead of hardcoding the value , is because the paths can change and trying to pre-empt ever every users move is a waste of time.Should just mention that the method above still returns the same folders as the first answer 我建议使用此方法而不是对value进行硬编码的唯一原因是,因为路径可能会更改,并且试图抢占每个用户的移动都是在浪费时间。仅需提一下,上述方法仍会返回与第一个答案

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在.net WPF应用中添加应用到windows启动发送arguments? - How to add application to windows startup sending arguments in a .net WPF application? 如何从Windows启动时将参数解析到.NET应用程序? - How to parse parameters to a .NET application from Windows startup? 运行 .net 核心应用程序作为 windows 应用程序并在 windows 启动时启动 - Run .net core app as windows application and start at windows startup 启动时控制台应用程序和.NET中的Windows应用程序有什么区别 - What is the difference between Console Application and Windows Application in .NET at startup 如何在 Windows 启动时运行 C# 应用程序? - How to run a C# application at Windows startup? 如何在Windows启动时启动最小化的ClickOnce应用程序? - How to start minimized ClickOnce application on Windows startup? 如何修复 .NET windows 应用程序在启动时崩溃并出现异常代码:0xE0434352? - How do I fix a .NET windows application crashing at startup with Exception code: 0xE0434352? Windows启动时的应用 - Application on windows startup 如果自定义配置设置在ASP.NET Core 2应用程序启动过程中不存在/无效(托管在Windows服务中),如何正常失败? - How to fail gracefully if custom configuration settings are not present/valid during ASP.NET Core 2 application startup (hosted in a Windows Service)? 在Windows启动时启动wpf应用程序 - Launch wpf Application on Windows startup
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM