1.

Solve : close a *.bat file from another *.bat file?

Answer»

can i do that? and how?Use taskkill:

Quote

TASKKILL [/S system [/U username [/P [password]]]]
{ [/FI filter] [/PID processid | /IM imagename] } [/F] [/T]

Description:
This command line tool can be used to end one or more processes.
Processes can be killed by the process id or image name.

Parameter List:
/S system Specifies the remote system to connect to.

/U [domain\]user Specifies the user context under which
the command should execute.

/P [password] Specifies the password for the given
user context. Prompts for INPUT if omitted.

/F Specifies to forcefully terminate
process(es).

/FI filter Displays a set of tasks that match a
given criteria specified by the filter.

/PID process id Specifies the PID of the process that
has to be terminated.

/IM image name Specifies the image name of the process
that has to be terminated. Wildcard '*'
can be used to specify all image names.

/T Tree kill: terminates the specified process
and any child processes which were started by it.

/? Displays this help/usage.

Filters:
Filter Name Valid Operators Valid Value(s)
----------- --------------- --------------
STATUS eq, ne RUNNING | NOT RESPONDING
IMAGENAME eq, ne Image name
PID eq, ne, gt, lt, ge, le PID value
SESSION eq, ne, gt, lt, ge, le Session number.
CPUTIME eq, ne, gt, lt, ge, le CPU time in the format
of hh:mm:ss.
hh - hours,
mm - minutes, ss - seconds
MEMUSAGE eq, ne, gt, lt, ge, le Memory usage in KB
USERNAME eq, ne User name in [domain\]user
format
MODULES eq, ne DLL name
SERVICES eq, ne Service name
WINDOWTITLE eq, ne Window title

NOTE: Wildcard '*' for the /IM switch is accepted only with filters.

NOTE: Termination of remote processes will always be done forcefully
irrespective of whether /F option is specified or not.

Examples:
TASKKILL /S system /F /IM notepad.exe /T
TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
TASKKILL /F /IM notepad.exe /IM mspaint.exe
TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM notepad.exe
TASKKILL /S system /U domain\username /FI "USERNAME ne NT*" /IM *
TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"

Reply if you want something more specific.if its not to much to ask, can it be a tad simpler, if it can't, thank you!Quote from: Amrykid on July 03, 2007, 09:23:53 PM
can i do that? and how?
show your code. Well, to simplify, I need your code, as ghostdog has just asked. But if you only hae one specif that you want to close, do this:

taskkill /f /im filename.batStart=sys\VSCAN\scanner.bat
@echo off

ping -n 1 -w 1000 1.1.1.1 >nul
echo 3 seconds to completion...
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo 2 seconds to completion...
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo 1 second to completion...
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo.
echo Writing results...

REM EXIT="sys\VSCAN\scanner.bat"
ECHO Scan COMPLETED!
pause
echo Gathering scanned item data
pause
start=sys\VSCAN\results.txt
exit "sys\VSCAN\scanner.bat
_________________________________
thats the code i used for a project i was doing.
the problem in the code is exit "sys\vscan\scanner.bat"Is that the contents of scanner.bat?

And is that actual code?
\/
Start=sys\VSCAN\scanner.bat

If you want real code (you'll need to here), do the FOLLOWING:
start "scanner.bat" "filepath\filename.bat"

And for your exits, do this:
taskkill /f /im "windowtitle eq scanner.bat"


Tell me if you get all that, or to tell me if I'm wrong.Quote from: Amrykid on July 03, 2007, 11:38:43 PM
Start=sys\VSCAN\scanner.bat
@echo off

ping -n 1 -w 1000 1.1.1.1 >nul
echo 3 seconds to completion...
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo 2 seconds to completion...
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo 1 second to completion...
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo.
echo Writing results...

REM EXIT="sys\VSCAN\scanner.bat"
ECHO Scan completed!
pause
echo Gathering scanned item data
pause
start=sys\VSCAN\results.txt
exit "sys\VSCAN\scanner.bat
_________________________________
thats the code i used for a project i was doing.
the problem in the code is exit "sys\vscan\scanner.bat"
I say you indeed have a design problem. Do everything in your scanner.bat BATCH file. you don't need a separate batch ...otherwise, show your scanner.bat file.i found out the problem. its was that i forgot to put exit in the choice area.
Yall remined me of that.
thanks!


Discussion

No Comment Found