如何使用其路径VB.NET关闭打开的程序 [英] How do I close an open program using its path VB.NET

查看:88
本文介绍了如何使用其路径VB.NET关闭打开的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我想知道是否有人知道如何通过其路径关闭程序或文本文件(C:\ Users \ brandon \Documents\NewTextDoc(2))或(C:\ Users \\ \\ brandon \Documents\Hey.exe作为示例,任何人都可以帮助我。谢谢。



我尝试过: < br $>


i真的没有尝试任何东西,我只是想尝试与程序一起玩,不知道从哪里开始这个有没有人知道我能做什么?

hello everyone i was wondering if anyone knew how i could close a program or textfile by its path so (C:\Users\brandon\Documents\NewTextDoc (2)) or (C:\Users\brandon\Documents\Hey.exe as an example can anyone help me out. Thanks.

What I have tried:

i havent really tried anything im just trying to have fun with programs and not sure where to start with this does anyone know what i could do?

推荐答案

你不能 - 你需要它来访问它。

想一想:如果我运行同一个程序的两个副本,你应该关闭哪一个?



您可以使用 Process.GetProcesses [ ^ ]获取所有当前正在运行的进程,然后 Process.Kill [ ^ ]以杀死特定进程。

每个Process对象都有可用于识别thr的属性你想要的: Process Class(System.Diagnostics) [ ^ ]包括ProcessName和MainWindowTitle
You can't - you need it's Process to access it.
Think about it: if I run two copies of the same program, which one should you close?

You can use Process.GetProcesses[^] to get all the currently running processes, then Process.Kill[^] to kill a specific process.
Each Process object has properties you may be able to use to identify thr one you want: Process Class (System.Diagnostics)[^] including the ProcessName and MainWindowTitle


这篇关于如何使用其路径VB.NET关闭打开的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆