在 Vista/Windows 7 中以编程方式关闭启动程序

发布于 2024-10-10 12:11:51 字数 212 浏览 0 评论 0原文

我希望能够编写一个脚本来关闭 Windows 启动中包含的应用程序。我知道常识是为什么不将其从启动中删除,但我希望它运行,因为该应用程序连接了我的 NAS。我只是每次都关闭它,因为除了它建立连接之外,我对实际的应用程序没有任何用处。

所以我想到了一个好主意,也许我可以编写一个脚本,该脚本也将在应用程序启动后在启动时运行,从而杀死/关闭它。

首先这听起来可能吗?有更好的办法吗?

I am looking to be able to write a script that will close an application that is included in the Windows start up. I know the common sense is why not remove it from start up, but I want it to run because the application connects my NAS. I just close it every single time because I have no use for the actual app except for the fact that it makes the connections.

So I got the bright idea that perhaps I could write a script that will also run in the startup after the app is launch that will kill/close it.

First does this sound possible? Is there a better way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

猥琐帝 2024-10-17 12:11:52

该应用程序是否将驱动器映射到 NAS 上的共享文件夹?如果是这样,那么您可以将其从启动文件夹中删除,并且可以:

  • 使用资源管理器的“映射网络驱动器”功能
  • 编写一个 BAT 文件以在启动时运行,该文件执行 NET USE 来映射
  • 编写一些 VBScript :),使用 WScript.Network.MapNetworkDrive

Is the app mapping drives to shared folders on your NAS? If so, then you could remove it from the Startup folder and either:

  • use Explorer's "Map Network Drive" feature
  • write a BAT file to run on Startup that does a NET USE to map
  • write some VBScript :), using WScript.Network.MapNetworkDrive
像你 2024-10-17 12:11:51

您可以创建一个 .bat 文件并在 NAS 程序运行后在启动过程中运行它。以下代码将杀死进程的所有实例(当前代码将杀死记事本)

Dim WMI, KillProc
暗淡进程名称:进程名称 =“notepad.exe”

设置 WMI = GetObject(“winmgmts:\.\root\cimv2”)
设置 KillProc = WMI.ExecQuery("Select * from Win32_ProcessWhere Name = '" & processName & "')

对于 KillProc 中的每个过程,
过程终止()
下一个

You can create a .bat file and run it during startup, after the NAS program has run. The following code will kill all instances of a process (the current code will kill notepad)

Dim WMI, KillProc
Dim processName: processName = "notepad.exe"

Set WMI = GetObject("winmgmts:\.\root\cimv2")
Set KillProc = WMI.ExecQuery("Select * from Win32_Process Where Name = '" & processName & "')

For Each Proc In KillProc
Proc.Terminate()
Next

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文