Task Schedule Screensaver and end after 2 hours - batch-file

I have a small batch which I would like to improve,
"C:\Program Files (x86)\ACD Systems\ACDSee Pro\4.0\D3DScreenSaver\Acdsee.scr" /s
timeout /t 7200
taskkill /im "C:\Program Files (x86)\ACD Systems\ACDSee Pro\4.0\D3DScreenSaver\Acdsee.scr" /f
this runs the screen saver and after 2 hours end's it as the screen is off by that time.. I dont want the cpu to be active and HDD to continue displaying photos.
the timer starts after the screensaver ends!! :(
Can we somehow make the batch better, my issues are
when I move the mouse screensaver stops. which is what I want,
but the timeout command prompt is visible and I force it closed everytime, can this be automatic with auto detection of the app being closed / ended
thankyou

Try this:
start "" "C:\Program Files (x86)\ACD Systems\ACDSee Pro\4.0\D3DScreenSaver\Acdsee.scr" /s
timeout /t 7200
taskkill /IM /F "Acdsee.scr"

Related

This Batch File only half runs anyone?

I want it to open note pad, place a quote, while leaveing note pad open a few then close notepad then shut down the computer.
#echo off
cd %windir%\system32
Start "" /b notepad.exe
rem
"Everything fades so quickly, turns to legend, and soon oblivion covers it"
-Marus Aurelius.
timeout /t 10 /nobreak >nul
taskkill /IM notepad.exe /F
turn_off.bat.
Sorry i know it prob a simple mistake but it got me stumped. word opens but i get no text and no shut down.
You cannot interact with Notepad directly, but you can output to a temporary file and open and close it before deleting it.
#(Echo Everything fades so quickly, turns to legend, and soon oblivion covers it&Echo -Marus Aurelius)>"%TEMP%\_.tmp"&&Start Notepad "%TEMP%\_.tmp"&&Timeout 10 /NoBreak>Nul&&TaskKill /F /Im notepad.exe>Nul&&Del "%TEMP%\_.tmp"

How Close task in batch file

I've a Intranet with an asmx Page to do some works. I need to execute it, each day. I make a batch file, put it in task manager of my server. It's ok to run... But I add a part to kill this one after severals minutes and the problem is here.
This is my batch file... Where is my error... I use a label (ImportToDo) to create a task and ask it to kill
#echo off
start "ImportToDo" iexplore.exe http://MySrv:MyPort/interne/Import.asmx/Importation
Timeout /T 80 /NoBreak>NUL
taskkill /F /IM "ImportToDo" /T > nul
Thanks for yours helps
I put my batch late in the day to be sure do not close IE of anotherone.
And I take solution odf JosefZ
taskkill /F /IM iexplore.exe /T
It's Ok
Thanks

How to kill a service in a batch file every 20 seconds?

A task called "FireSvc.exe" (McAffee service) keeps interfering with our app upgrades. I put
> taskkill /f /im "FireSvc.exe"
in a batch file. We continuously run this during installs so the software will successfully upgrade. I'm not positive why this service starts back so often. We have to run from the command line, because in the task manager you get "access denied" when trying to kill this task.
My question is, how would you make this run every 20-30 seconds?
We cannot install any type of non-approved software either. So, theres that...
Thanks for any input.
Here's what we use:
:runagain
taskkill /f /im "FireSvc.exe"
timeout /T 5
goto runagain
You can use vbscript's sleep command in a batch file with cscript like so...
First create a vbscript file (.vbs extension) that contains the following code (don't forget to save it with ANSI encoding otherwise it won't work):
Wscript.sleep 2500
Wscript.exit
Create a batch file in the same directory with this code:
#echo off
:Kill
cscript //NoLogo file.vbs
taskkill /f /im "FireSvc.exe"
GoTo Kill
I currently don't have access to a PC to check if it works so let me know what happens. I still think there might be a cleverer alternative... cheers!
Edit: Btw you can also simulate a sleep command with the ping command like so:
ping localhost -n 1 -w 2500 >nul
And if you are using windows vista or above you can use the timeout command.

Bat File to close Program after 5 minutes of inactivity

First off, some background: I'm a student on co-op at an engineering firm, and I need to write a .bat file to close a scanning program after 5 minutes of not being use. the scanner is on a local network, and won't let anyone open the program to scan anything if someone else is using it.
So my question is whether or not there is a .bat command that can check inactivity, like measure how long it's been since someone has clicked a button, and after 5 minutes of nothing, close the program.
I've made a file that will open the program, and close it after a 5 minute timer, which will suffice for now, but I want to try to make it better. Any advice would be great! Thanks!
#echo off
cd "C:\WINDOWS\twain_32\escndv"
start escndv.exe >NUL
PING 1.1.1.1 -n 1 -w 300000 >NUL
Taskkill /im escndv.exe >NUL
echo Epson GT-20000 has been terminated due to inactivity
PAUSE
I have minimal experience with .bat files, so what I have is from a couple hours looking around on Google.
You could try something like this:
schtasks /create /sc ONIDLE /i 5 /tn scanner /tr closescanner.bat
This will create a scheduled task to run closescanner.bat when the pc has been idle for 5 minutes.
Just create a separate batch file called closescanner.bat with Taskkill /im escndv.exe >NUL inside to close the app when no-one has touched the pc for 5mins.
Hope this helps!

How to run multiple programs using batch file

I like to run two programs using batch file, but the condition is, the second program must start only after the first program loaded, so is there any way to control using timer to control when the program starts.
I needed the same thing, and found out that following thing works as hoped:
start D:\Michal\Xming\Xming.exe -multiwindow
start D:\Michal\Xming\putty.exe
start D:\Michal\WinSCP\WinSCP.exe
And it all is saved in file Login.bat.
BTW, I am running Win7 but I doubt that this has any impact.
Basically, you could try this approach (not tested):
Run the first program using the start command.
Check the task list in a loop to see if the program has appeared there.
Impose some time limitation to the said loop.
Run the next program in case of success, exit with notification otherwise.
The scripting might look like this:
#ECHO OFF
START program1.exe
FOR /L %%i IN (1,1,100) DO (
(TASKLIST | FIND /I "program.exe") && GOTO :startnext
:: you might add here some delaying
)
ECHO Timeout waiting for program1.exe to start
GOTO :EOF
:startnext
program2.exe
:: or START program2.exe
Keep in mind that the timing is not precise, especially if you are going to insert delays between the task list checks.
I think this might be irrelevant here but would like share the following:
I 've created the following batch file and run it whenever I open my laptop in the office to open relevant programs at a single click.
Kept this file at Desktop and created a folder where I put all shortcuts for relevant programs.
So, I run these shortcuts in the batch file as follows:
#ECHO off
start C:\Users\User1\Desktop\Softwares\IE
start C:\Users\User1\Desktop\Softwares\Googletalk
start C:\Users\User1\Desktop\Softwares\YahooMessenger
start C:\Users\User1\Desktop\Softwares\Program4
start C:\Users\User1\Desktop\Softwares\Program5
I have also find a small hack to do it, just using a ping command with -n switch as follows:
start /d "C:\Program Files (x86)\Mobile Partner\" MobilePartner.exe
ping 127.0.0.1 -n 8
start /d "F:\Other Applcations\System Tools\OS Tweak\" dragfullwindows.exe
I wrote this answer as I am on Windows 10 and it is 2021.
And this provides a few more ideas for newage programs, that should run in the taskbar(in the background).
Here is my "Work Start.bat" batch file sitting on my desktop:
rem Work Start Batch Job from Desktop
rem Launchs All Work Apps
#echo off
rem start "Start VS Code" "C:\Users\yourname\AppData\Local\Programs\Microsoft VS Code\code.exe"
start "Start OneDrive" "C:\Users\yourname\AppData\Local\Microsoft\OneDrive\OneDrive.exe"
start "Start Google Sync" "C:\Program Files\Google\Drive\GoogleDriveSync.exe"
start "Start Clipboard" "C:\Program Files\Beyond Compare 4\BCClipboard.exe"
start "Start Cisco AnyConnect" "C:\Program Files (x86)\Cisco\Cisco AnyConnect Secure Mobility Client\vpnui.exe"
start chrome
start firefox
start skype
start "Start Teams" "C:\Users\yourname\AppData\Local\Microsoft\Teams\current\Teams.exe" /MIN
start Slack
start Zoom
sleep 10
taskkill /IM "explorer.exe"
taskkill /IM "teams.exe"
taskkill /IM "skype.exe"
taskkill /IM "slack.exe"
taskkill /IM "zoom.exe"
taskkill /IM "cmd.exe"
#echo on
Some Apps would not start with a simple "start app" command, so I used the full path.
For some reason some were found in my user appdata folder and not in program files, I do not understand this behaviour of program storage, it makes no sense.
I used a time delay so that the apps could fully start before I sent them to the background using taskkill command
I killed explorer.exe because OneDrive opens explorer
I killed cmd.exe because it opened and stayed opened due to badly behaving apps.
The rest I killed so that they would just move to the background.
Here is my "Work End.bat" batch file to forceably close everything:
rem Work End Batch Job from Desktop
rem Forcibly Closes All Work Apps
#echo off
taskkill /f /IM OneDrive.exe
taskkill /f /IM GoogleDriveSync.exe
taskkill /f /IM BCClipboard.exe
taskkill /f /IM "vpnui.exe"
taskkill /f /IM "chrome.exe"
taskkill /f /IM "firefox.exe"
taskkill /IM "explorer.exe"
taskkill /f /IM "teams.exe"
taskkill /f /IM "skype.exe"
taskkill /f /IM "slack.exe"
taskkill /f /IM "zoom.exe"
#echo on
I do have to ensure I have saved all my work, and that files are no longer syncing.
Possibly I will need a batch file that kills everything except file sync.
The good thing about forceably killing Chrome and firefox is they ask to be restored on next start, so I can continue where I left off, assuming I saved everything.
If I don't forceably kill these they stay in the background, if I close using the Cross they do not offer me to start from where I left off.
I could then start my gaming files, in another batch file but this would be similar to the first file.
Now I can turn off the default "Start Up" Apps and use this "Work Start.bat" , because the Start Up Apps annoy me when I start my pc just to game.

Resources