Batch File Keep Window Open

20.09.2019by admin
Batch File Keep Window Open Average ratng: 5,2/10 6557 votes
  1. Windows 10 Batch File Commands
  2. Batch File Keep Dos Window Open

I would like to have the console window kept open when running a scheduled task which executes a batch file. If I run it manually meaning execute the batch file the window stays open but through task scheduler it doesn't open but I can see the task is still running. I put a pause at the end to do this.

Windows 10 Batch File Commands

Prompt

Double click a Windows batch file (.bat,.cmd) and keep the command prompt open Abstract. This is a quick tip about Windows batch files (.bat,.cmd). I often use these files to setup different development environments; setting environment variables. How do I keep this screen open. Well, if you are on windows, run cmd (I keep a batch file for it on my desktop but start run cmd is all you need). 'My Batch File' 2. 'Some Other Batch File' I've created a shortcut of the first batch file and edited its properties to call its in following way. Cmd.exe /k ' Batch File.bat' & pause What i want to do I want the console window to be open after the execution of the batch file is over. Now it just closes, tried to play around.

@echo offTITLE PROCESSMGRtasklist /FI 'IMAGENAME eq JOESMO.exe' find /I 'JOESMO.exe'nul &&(echo PROCESSJOESMO.exe IS ALREADY RUNNING!echo%DATE%echo%TIME%pause) (echo JOESMO PROCESS IS NOT RUNNINGcmd /c start 'JOESMO.exe' 'C:UsersxxxxDocumentsVisual Studio 2010ProjectsProjects2013JOESMO.exe'pause)I found this suggestion cmd /k myscript.bat but having creating the task in task scheduler for windows server 2008 I am not sure where to apply this. I added /k to the add arguments box in edit action in task. Unfortunately Ken's solution didn't work for me on a Windows 2008 R2 Std server, I was able to launch an interactive window by modifying the scheduled tasks setting using schtasks.exeIn a command window I did the following command: schtasks /Change /TN 'My Task' /ITHowever that does require you be logged in as the same user context in which the scheduled task is executing. So if your scheduled task is use the localsystem 'taskaccount' then you will have to log into the system as the 'taskaccount' user.Oddly enough it worked when I manually run the task but it didn't pop for me when it kicked off at a scheduled time. I tried all of the above, but they did not work for me. Here is what I did to get this to work:PlatformWindows Server 2003 R2 SP2ActivePERL v5.10.1Steps.

Batch File Keep Dos Window Open

Create DOS BATCH script - this runs the actual program, ie, myscript.bat. Create PERL script to call the DOS batch script, ie, myscript.pl. myscript.pl is a 1-line script: system('e:scriptsmyscript.bat');. Create scheduled task: perl myscript.plThe DOS command prompt window now always opens up. And more importantly, the task now successfully runs and completes. NOTE: The scheduled task RunAs user is logged in to the server.