Answer the question
In order to leave comments, you need to log in
Why doesn't my batch file end the process?
Hey!
There is a BAT file. Which should monitor the folder for the presence of pdf files in it, if the file appears, it must be printed and deleted.
the problem is that it works with the first file, then Adobe reader does not close completely, a window with a list of recent documents remains, etc.
I tried to add taskkill /f /im AcroRd32.exe but the process hangs on and the printing does not continue accordingly.
@echo off
chcp 866 >nul
set time=5
:loop
for %%i in (*.pdf) do (
"C:\Programme\Adobe\Reader 10.0\Reader\AcroRd32.exe" /t "%%i%" "A3SWEin" "OKX058RM.DLL" "IP_192.168.160.113"
)
taskkill /f /im AcroRd32.exe
for %%i in (*.pdf) do (
erase *.pdf
)
ping 127.0.0.1 -n %time% >nul
Goto :loop
Answer the question
In order to leave comments, you need to log in
Hello, maybe because you have a loop at the end that teleports all the time to the mark above without stopping?))
PS: goto loop
To score on all sorts of batch files and use the standard Windows scheduler, since it can run commands and track events. Plus, it kills processes itself if they run longer than such and such a time, etc.
Recursion.
function getRecursiveStr($arr) {
$t = [];
$keys = array_keys($arr);
foreach ($keys as $key) {
if (is_array($arr[$key])) {
$t[] = $key;
$t[] = getRecursiveStr($arr[$key]);
} else {
$t[] = $arr[$key];
}
}
return implode(', ', $t);
}
$a = [
"Один" => [
"Два" => [
"2.87" => [
"2.88",
"2.89"
],
"Три" => [
"Три с половиной",
"Четыре"
]
]
]
];
echo getRecursiveStr($a); // выведет "Один, Два, 2.87, 2.88, 2.89, Три, Три с половиной, Четыре"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question