- image.png (12.93 KiB) Viewed 1930 times
How to auto close cmd after it has finished executing?
How to auto close cmd after it has finished executing?
note I'm not asking about silent execution, but how to know when cmd has completed and thus can exit by itself.
- Masonjar13
- Posts: 1555
- Joined: 20 Jul 2014, 10:16
- Location: Не Россия
- Contact:
Re: How to auto close cmd after it has finished executing?
Assuming you're typing this out, just add & exit to the end of the command.
Re: How to auto close cmd after it has finished executing?
that's easy. Thank you!
Re: How to auto close cmd after it has finished executing?
also : run,%comspec% /c , means close DOS window after command finished , %comspec% /k , keep DOS window
an example
an example
Code: Select all
#warn
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetKeyDelay, 80, 10
e4x=
(Ltrim join&&
@echo off
echo date=
date /t
echo time=
time /t
cd\
)
title2=DOS_TEST
run, %comspec% /T:0A /k "title %title2%&mode con lines=4000 cols=120&%e4x%,,,pid2
WinWait, ahk_pid %pid2%
WinMove, ahk_pid %pid2%, ,1,1,, ;- move DOS window to the defined position
WinWaitactive, ahk_pid %pid2%
SendInput {text}ver`n
sleep,1000
controlsend,ahk_parent,{text}dir`n,ahk_pid %pid2%
ControlSend,ahk_parent,{text}@echo Quit this DOS in 6 seconds`r,ahk_pid %PID2%
sleep,6000
ControlSend,ahk_parent,{text}exit`r,ahk_pid %PID2% ;-- quit DOS after 6 seconds
return
Who is online
Users browsing this forum: Bing [Bot], Google [Bot], Rohwedder and 172 guests