问题标签 [startup-folder]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2426 浏览

vb.net - 使用 VB.Net 将图标复制到启动文件夹

我想将一个图标从 vb.net 代码复制到计算机的启动文件夹中。

0 投票
2 回答
4035 浏览

java - 如何使用 Java 找到 Startup 文件夹的位置?

在我的 Java 程序中,我怎样才能找到启动文件夹在用户 PC 上的位置?我知道它在不同版本的 Windows 上有所不同。我只需要我的应用程序就可以在 Windows 上运行。任何示例代码?

0 投票
1 回答
197 浏览

windows - 当用户登录 Windows 时,我需要运行我的 exe,请告诉我执行此操作的步骤

我已将我的 exe 复制到启动文件夹,它在 Windows 重新启动时工作正常,但是当计算机从休眠或睡眠模式恢复时我也需要运行 exe。请帮助我!

提前致谢 !

0 投票
1 回答
3615 浏览

.net - 在启动时运行应用程序:注册表项与启动文件夹

我想在启动时运行一个应用程序。我知道有几个选择。我对以下选项最感兴趣:

  1. 注册表方法:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
  2. 将快捷方式复制到启动文件夹:C:\Users\@username@\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

这两个选项有什么区别吗?

0 投票
1 回答
1239 浏览

assembly - 环境变量 - 启动文件夹

启动文件夹是否有环境变量。

在 XP 上它位于 C:\Documents and Settings(user)\Start Menu\Programs\Startup 下,而在 vista 7 下它位于 Appdata\Microsoft\Windows\Start Menu\Programs\Startup\

所以我想知道这个文件夹是否有 EnVar?

0 投票
1 回答
245 浏览

c#-4.0 - 启动文件夹中的 App.Config 问题

我正在用 c#.net 编写一个控制台应用程序。我有一个批处理文件,当前将 exe 和 exe.config 从网络复制到本地计算机上的启动文件夹。它是这样设置的,因此用户只需运行批处理文件,然后每次启动计算机时,exe 都会运行。

我遇到的问题是它也打开(或尝试打开)exe.config 文件。我正在寻找最好的解决方法,而不会过于复杂。考虑将配置文件放在不同的位置,然后将新位置硬编码到配置管理器中,但配置文件的概念之一是将所有硬编码路径保留在代码之外,以便在位置更改时更容易更新。还考虑在启动文件夹中放置 exe 的快捷方式,这将起作用,但我希望它对用户透明。换句话说,我希望用户做的只是运行 .bat 文件一次,然后忘记它。

任何帮助或想法将不胜感激,因为我对 .bat 文件非常陌生

0 投票
2 回答
12399 浏览

wpf - 如何将启动uri属性设置为wpf项目文件夹中的另一个窗口

在我的 wpf 项目中,我创建了一个名为 practice 的文件夹,在该文件夹中我添加了一个窗口,现在我想运行该窗口,所以在 app.xaml 文件中我将启动 uri 设置为 foldername.window.xaml 但它说的是 build操作属性未设置为资源。

为此,我将构建操作属性设置为资源。现在这一次它显示错误消息已初始化的组件在当前上下文中不存在。

你能告诉我当我们在 wpf 项目中创建单独的文件夹并且这些文件夹包含窗口或页面时我们需要设置哪些属性。以及如何在其他页面或 App.Xaml 文件中的 startupUri 属性中访问这些页面。

0 投票
1 回答
182 浏览

wpf - WPF Vb.net Copyto 不起作用?

我只是想触发一个将程序复制到 Startup 文件夹的事件。我不明白我哪里出错了?我不断收到异常消息。正在复制的文件未在使用中。

0 投票
4 回答
1163 浏览

c# - 将 XML 文件设置为启动路径

我有带有 XML 文件的 C# windows 应用程序。安装设置文件后,我需要不时编辑 XML 文件。但是我的 XML 文件不会转到可执行文件所在的路径。所以这是错误的。在一个程序中,我得到了这样的 XML 路径。

请有人可以建议一种方法。

0 投票
1 回答
4389 浏览

batch-file - Batch File To Get It's Own Directory Or The Directory Defined In The "Start In" Property Of A Shortcut

I am writing a batch file on my Windows 8.1 machine. In one section of my batch file I need to start a command prompt in the "current working directory".

So far, this is what my batch file looks like:

Let's say the batch file is located in the folder C:\Temp\Utilities. If I open an explorer window and double click the batch file to run it everything works great. A new command prompt is created in the directory C:\Temp\Utilities. However, if I right-click the batch file and select Run as administrator the working directory is no longer the location of the batch file, it's C:\Windows\System32.

Similarly, if I create a shortcut to the batch file in a different folder (for example. C:\Temp) and repeat the two steps above the results are the same. If I double click the shortcut and run it as a normal user the working directory is what I would expect. (Note, the working directory for the shortcut it's whatever is set for "Start in" of the shortcut properties, not the location of the batch file.) If I right click the shortcut and run it as administrator I again get a command prompt opened to the folder C:\Windows\System32.

I assume this is a "bug" or "feature" (if you want to call it that) in Windows 8.1 and it probably happens because execution environments for programs run as administrator are forced to run in the System32 folder? (I remember with Windows 7 this did not happen so it must be a new feature to Windows 8.)

I found one way to fix the issue and stop the command prompt from starting in C:\Windows\System32. I did this by modifying the following line in the batch file:

Doing it this way sets the working directory to the location of the batch file. With this change, no matter how I run the batch file or the shortcut (administrator or normal) the working directory ends up being the same, C:\Temp\Utilities.

The problem with this solution is I don't want the working directory to always be the location of the batch file. If the batch file is run directly then it's okay but if I run it from a shortcut I need the working directory to be whatever is set in the "Start in" property of that shortcut. For example, if the batch file is located in the folder D:\Temp\Utilities this is what I need to happen regardless of whether I run as administrator or not:

What this means is I can't always use %~dp0 to set the working directory in my batch file. What I need is some way for the batch file to know if it was run either directly or by a shortcut. If the batch file is run directly then the working directory is easy to get, it's just the value of %cwd%. If the batch file is run by using a shortcut, I don't know how to get the "Start in" property inside the batch file.

Does anyone know how I can do these two things inside my batch file:

1. Check whether it was run directly or by a shortcut.

2. If run by a shortcut, get the "Start in" property of the shortcut that started it.

Thank you,

Orangu

UPDATE

I found sort-of a "hackish" way to fix the issue. For the shortcut I edited the "Target" field and changed it to the following:

Now the working directory can be obtained by calling %CD% in the batch file and this works for both administrator and normal users. It does not, however, work for the case when I run the batch file directly. I still need to use %~dp0 in that case.

I don't like this solution, however, because it requires me to manually change all shortcuts I make and it also makes the icon look like a cmd prompt icon rather than a batch file.