Close CMD Window

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
johnpc
Posts: 6
Joined: 24 Sep 2015 03:19

Close CMD Window

#1 Post by johnpc » 03 Jan 2017 08:40

How can I get the Cmd Window to close in the following batch file?


@ECHO OFF

cd "C:\Users\John\AppData\Local\Temp"

start %Temp%
cls

cd "C:\Program Files (x86)\CleanTempDirs"
start "CleanTempDirs.exe"

exit 0

cls

aGerman
Expert
Posts: 3078
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Close CMD Window

#2 Post by aGerman » 03 Jan 2017 08:52

The first parameter of START that is enclosed into quotation marks will be supposed to be the window title. Pass an empty string as first argument
start "" "CleanTempDirs.exe"

Steffen

Compo
Posts: 453
Joined: 21 Mar 2014 08:50

Re: Close CMD Window

#3 Post by Compo » 03 Jan 2017 12:52

you don't need to use CD or CLS either:

Code: Select all

@Start "" "%TEMP%"
@Start "" "%ProgramFiles(x86)%\CleanTempDirs\CleanTempDirs.exe"

johnpc
Posts: 6
Joined: 24 Sep 2015 03:19

Re: Close CMD Window

#4 Post by johnpc » 08 Jan 2017 07:50

Thank You

Post Reply