Page 1 of 1

How to set a dos command line windows title ?

Posted: 25 Apr 2019, 17:34
by takayo97
I have a video encoder dos command line called NvenCC64.exe
I wrote a autohotkey to browse a video and call this command line encoder for video encoding
It looks like
Image

i use following ahk command to call the encoder
RunWait, %encoder%
where the variable encoder is a full command line and arugments, something like
encoder := cmdline . trim . vfr . cmdopts . sourcefile . videocodec . targetfile

How to set title command line windows title when it is running ? but now just display the command line exe shown on the screenshot

Re: How to set a dos command line windows title ?

Posted: 25 Apr 2019, 19:44
by Osprey
Use WinSetTitle, like so:

WinSetTitle, ahk_exe NVEncC64.exe,, This is the new title

Make sure that the script is running as admin if NVEncC64.exe is running as admin.

Re: How to set a dos command line windows title ?

Posted: 25 Apr 2019, 20:06
by TAC109
Alternatively, you could use the DOS Title command in the DOS script.

Re: How to set a dos command line windows title ?

Posted: 26 Apr 2019, 18:19
by takayo97
Osprey wrote:
25 Apr 2019, 19:44
Use WinSetTitle, like so:

WinSetTitle, ahk_exe NVEncC64.exe,, This is the new title

Make sure that the script is running as admin if NVEncC64.exe is running as admin.
I'm sorry. it was not working. Nothing changed on the title

Re: How to set a dos command line windows title ?

Posted: 26 Apr 2019, 18:37
by Osprey
takayo97 wrote:
26 Apr 2019, 18:19
I'm sorry. it was not working. Nothing changed on the title
It worked for me when I tested with diskpart.exe (I tried with NVEncC64.exe, but it complained that I don't have an Nvidia library installed). As I mentioned, are you running the script with the same credentials as the program (i.e. as administrator if the program is being run as admin)? If so, try running the script with AutoHotkeyU64.exe.

If nothing works, you could simply try WinSetTitle, ahk_exe cmd.exe,, This is the new title, though that could apply to the wrong command window if you have more than one open.

Re: How to set a dos command line windows title ?

Posted: 29 Apr 2019, 18:08
by takayo97
the script is not running as admin

Re: How to set a dos command line windows title ?

Posted: 29 Apr 2019, 19:56
by TAC109
What’s in your 'cmdline' variable? You may be able to add title My New Title & to the beginning of this variable. (The & chains 2 Dos commands together.)

Re: How to set a dos command line windows title ?

Posted: 30 Apr 2019, 10:00
by garry
DOS test with > youtube-dl -U ( remove/replace this command in variable e4x )

Code: Select all

;- DOS_Example with Title ( see Title alone when DOS-commands finished )
;- example : updates youtube-dl.exe > "youtube-dl -U"
#warn
setworkingdir,%a_scriptdir%
SetKeyDelay,20,20

wa:=a_screenwidth
ha:=a_screenheight
W :=(wa*50)/100    ;- width
H :=(ha*92)/100    ;- height

title2=DOS_TEST
e4x=
(Ltrim join&
@echo off
title %title2%
mode con lines=4000 cols=120
echo date=
date /t
echo time=
time /t
ver
youtube-dl -U

)
run, %comspec% /T:0A /k %e4x%,,,pid2
WinWait, ahk_pid %pid2%
WinMove, ahk_pid %pid2%, ,1,1,%w%,%h%       ;- move DOS to the right position
;sleep,1000
;controlsend,,youtube-dl -U`r,ahk_pid %pid2%
;- or :
;clipboard=youtube-dl -U
;send,^v`r
return
;================================================
Result :

Code: Select all

date=
30.04.2019
time=
16:52

Microsoft Windows [Version 10.0.17763.437]
youtube-dl is up-to-date (2019.04.30)