How to set a dos command line windows title ?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
takayo97
Posts: 63
Joined: 09 Jun 2018, 16:30

How to set a dos command line windows title ?

25 Apr 2019, 17:34

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
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

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

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.
TAC109
Posts: 1111
Joined: 02 Oct 2013, 19:41
Location: New Zealand

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

25 Apr 2019, 20:06

Alternatively, you could use the DOS Title command in the DOS script.
Last edited by TAC109 on 26 Apr 2019, 18:32, edited 1 time in total.
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
takayo97
Posts: 63
Joined: 09 Jun 2018, 16:30

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

26 Apr 2019, 18:19

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
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

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

26 Apr 2019, 18:37

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.
takayo97
Posts: 63
Joined: 09 Jun 2018, 16:30

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

29 Apr 2019, 18:08

the script is not running as admin
TAC109
Posts: 1111
Joined: 02 Oct 2013, 19:41
Location: New Zealand

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

29 Apr 2019, 19:56

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.)
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
garry
Posts: 3758
Joined: 22 Dec 2013, 12:50

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

30 Apr 2019, 10:00

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)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 246 guests