Reputation: 4539
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?
Upvotes: 0
Views: 860
Reputation:
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
Upvotes: 2
Reputation: 5696
Is the app mapping drives to shared folders on your NAS? If so, then you could remove it from the Startup folder and either:
Upvotes: 2