简体   繁体   English

XPe中的Autostart C ++ win32控制台应用程序

[英]Autostart C++ win32 console application in XPe

I have a Win32 Console Application which I would like XPe to autostart when the system boots up. 我有一个Win32控制台应用程序,我希望XPe在系统启动时自动启动。

What i have done currently is to put this app path in the registry HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run. 我目前正在做的是将此应用程序路径放入注册表HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Microsoft \\ Windows \\ CurrentVersion \\ Run。

However, it does not seem to work with console applications? 但是,它似乎不适用于控制台应用程序吗? as i have tried with GUI apps and it works. 正如我尝试过的GUI应用程序,它的工作原理。

Thanks! 谢谢!

Like I said in my comment you could add a shortcut to the application under the AutoStart folder in the start menu. 就像我在评论中说的那样,您可以在开始菜单的AutoStart文件夹下向应用程序添加快捷方式。

From the help for the start command: start命令的帮助中:

When executing an application that is a 32-bit GUI application, CMD.EXE does not wait for the application to terminate before returning to the command prompt. 当执行的应用程序是32位GUI应用程序时,CMD.EXE在返回命令提示符之前不会等待该应用程序终止。 This new behavior does NOT occur if executing within a command script. 如果在命令脚本中执行,则不会发生此新行为。

So it seems like starting a 32-bit non-GUI application would wait for the application to terminate unless you would place a call to it inside a batch file or similar and then in turn call start on that batch script instead. 因此,似乎启动32位非GUI应用程序将等待应用程序终止,除非您将对它的调用放在批处理文件或类似文件中,然后依次调用该批处理脚本上的start。

Try creating a file named something like your-app.bat and add the following command inside it: 尝试创建一个名为your-app.bat类的文件,并在其中添加以下命令:

 start /D "C:\Test\" WindowsApplication1.exe

Then in your registry point to your newly created batch script instead of the actual executable. 然后在注册表中指向您新创建的批处理脚本,而不是实际的可执行文件。

Use Task Scheduler. 使用任务计划程序。 0123456789 0123456789

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM