问题描述
- 程序语言中使用 shell 怎么给其中参数传值呢
-
其中initprocessID 是PID 进程号,有没有知道呢?我这样写的不行啊,怎么修改呢?如下:Shell "cmd.exe /c taskkill -pid initprocessID /f", vbHide
我用的是VB 写的,求指教,谢谢!
解决方案
可以用ShellExecute API
Public Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
ShellExecute 0, "open", "cmd.exe", "/c taskkill -pid initprocessID /f", App.Path, 0
时间: 2024-10-26 02:20:17