View Full Version : Batch to Shutdown
09-03-2007, 12:02 PM
I have made a batch script that will remotely shut down pc's however is there a way i can add a timeout to it and also to avoid it if the pc is running a certain application?
the following is my code
echo WARNING! This will shutdown all machines currently swiched on.
echo Do you wish to continue?
shutdown -s -m 22.214.171.124 -f -c "Please ensure your machine is switched off before you leave your workstation. Shutdown will commence shortly."
echo Process Complete.
09-03-2007, 04:11 PM
You can use pslist (http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/PsList.mspx) and redirect the output to a txt file. Once you have the list of process use some logic to see if the app your looking for is running and go from there.
09-03-2007, 06:15 PM
how do i redirect the output to a text file?
09-03-2007, 09:54 PM
pslist.exe > testfile.txt
09-04-2007, 12:38 PM
OK that worked like a charm,
how do i get it to look through that to say find... word.exe?
09-05-2007, 04:29 PM
Searches for a text string in a file or files.
FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]
/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/OFF[LINE] Do not skip files with offline attribute set.
"string" Specifies the text string to find.
Specifies a file or files to search.
If a path is not specified, FIND searches the text typed at the prompt
or piped from another command.
09-07-2007, 06:06 PM
How would I use a conditional statement once its found the line?
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.