1. Joined : Jan 2016
    Amsterdam
    Posts : 7
    Windows 10
       19 Mar 2016 #1

    Making CMD Go Away After Task Is Done


    Hello,

    I have a scheduled task set to run once per week. It executes a batch file that uses 7zip commands to zip a folder. It looks like:

    Code:
    @echo off
    
    
    taskkill /im "plex media server.exe"
    
    
    7za u "D:\odrive\Amazon Cloud Drive\Plex\plexbackup.7z" D:\plexdata -mx0 -up1q0r2x1y2z1w2
    
    
    "C:\Program Files (x86)\Plex\Plex Media Server\plex media server.exe"
    The script works exactly as I want to, and it runs on schedule once per week in the middle of the night, according to the settings in Windows Task Scheduler. The final line that displays in the CMD window is "Everything is OK" which is the 7zip signal that everything went as expected. My problem is that the CMD window that displays the progress while the script is running does not disappear after it is done. This is annoying for me because the machine is a home theater PC, and the prompt appears on top of my home theater app. In order to get rid of it, I have to hook up my remote keyboard and mouse.

    How can I make the CMD window go away when it is done?

    Thanks
      My System SpecsSystem Spec


  2. Joined : Feb 2015
    Posts : 0
    Dual Boot 10 Pro v1607 10 Pro rs2 build 14971
       19 Mar 2016 #2

    Use exit as the last line of the script should do it.
      My System SpecsSystem Spec


  3. Joined : Jan 2016
    Amsterdam
    Posts : 7
    Windows 10
       31 Mar 2016 #3

    Exit is not doing it.

    Normally typing exit in the CMD will shut it down, but in this case it doesn't.

    The last line displaying in the window is: "Everything is OK"

    It remains at that, so I don't think it is processing the exit command.

    There must be another way to make this happen.
      My System SpecsSystem Spec


  4. Joined : Jul 2015
    California
    Posts : 186
    Kernel 4.x.x
       31 Mar 2016 #4

    7Zip returns after it's finished executing, Which means a command window will exit.

    Are you sure that Plex media server.exe isn't holding the command prompt open? Try this instead.

    Code:
    @ECHO OFF
    TASKKILL /IM "plex media server.exe"
    7za u "D:\odrive\Amazon Cloud Drive\Plex\plexbackup.7z" D:\plexdata -mx0 -up1q0r2x1y2z1w2
    START "" /B "C:\Program Files (x86)\Plex\Plex Media Server\plex media server.exe"
      My System SpecsSystem Spec


  5. Joined : Jan 2016
    Amsterdam
    Posts : 7
    Windows 10
       01 Apr 2016 #5

    Thanks. This worked. What is different about using the start command instead of just calling it?
      My System SpecsSystem Spec


 


Similar Threads
Thread Forum
Making MSN go away.
So. At the moment, I have no working phone jacks in my house and am therefore throwing money at my neighbour while I wait for a tech to actually show up. This means that while my desktop is online, my HTPC is not: it lives in its own little world...
Browsers and Email
Making a new custom PC
Hi, I'm new here. I'm previously from the Win8.1 forums. So, does my custom PC fully supports Windows 10? Here is the specs of my "wanna be" custom PC : CPU : Intel Core i7-5775C with Intel Iris Pro Graphics 6200 GPU : NVidia GeForce GTX 750 ti...
PC Custom Builds and Overclocking
How to show Command Prompt Window when running task in Task Scheduler?
Is there a way to make the "Command Prompt" window show when I have a task running in Windows task Scheduler? I would like to be able to view the progress of the task. For example, I have a program called "Zap2xml" that collects TV EPG data. It...
General Support
Solved Time Zone change causes error in Task Scheduler for every task
My issue is kind of strange. I am an insider currently on Windows 10 build 10240. All the build I have tried so far has this same error in task scheduler when I change my time zone to my current location which is kathmandu (UTC+5:45). When i change...
Performance & Maintenance
Video making conversation
Chillout Room
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 20:57.
Find Us
Twitter Facebook Google+



Windows 10 Forums