English 中文(简体)
任务:不同的行为范围与文字
原标题:taskkill: different behaviour console vs. script

我正在撰写一幅小刀切的申请。 我拿到这张id子,然后试图做以下工作:

taskkill /t /pid !pid!

If I am running the command from the console (typing it by hand) everything works fine. I see the shutdown routine being executed in the java console and afterwards the java console is gone. I sometimes see the windows "process not responding. kill now or wait" dialog after a few seconds but the dialog is automatically closed when the java program stops.

如果一经同一指挥处执行一个批次档案,我就立即看到“没有答复的程序”。 我看到了黄色产出:“工艺已成功关闭”,但 j鱼仍然开放。 它甚至没有启动关闭顺序。

编辑:完整打字

@echo off
setlocal enabledelayedexpansion
if exist .lock (
set /p pid=< lock
taskkill /t /pid !pid!
) 
问题回答

关于指挥线路<代码>!pid! 通常不会扩大,因为延迟扩展是残疾的,只能由登记站或<代码>cmd /V:on提供。

因此,在指挥线<代码>!pid!上将保持不变,在批次中,这一编号将扩大到<代码>pid变量的内容。

Edit As you show the correct command on the cmd line, the command in the batch must be wrong.

在定点/排线之后,你应当加上一个回合。

Echo pid="!pid!"




相关问题
Why running a service as Local System is bad on windows?

I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...

Programmatically detect Windows cluster configuration?

Does anyone know how to programatically detect that a Windows server is part of a cluster? Further, is it possible to detect that the server is the active or passive node? [Edit] And detect it from ...

get file icon for Outlook appointment (.msg)

I ve read Get File Icon used by Shell and the other similar posts - and already use SHFileInfo to get the associated icon for any given extension, and that works great. However, Outlook uses ".msg" ...

Identifying idle state on a windows machine

I know about the GetLastInputInfo method but that would only give me the duration since last user input - keyboard or mouse. If a user input was last received 10 minutes ago, that wouldn t mean the ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...

热门标签