Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

When asking a question in the Support Forum

Aug
2,799
144
When people post problems/questions in the Support Forum,
the first reply is usually...

Is this in a Take Command tab window,
a Windows Terminal tab window,
or a TCC stand-alone console window?

What code page?

Are you running as Admin?

Are you running elevated?

What Windows Version?

What version and build of TCC?

What font are you using?

...etc.

Here's the beginnings of tccinfo.btm
from which you can capture the output,
and paste into your message with your support question.

Code:
@SETLOCAL
@ECHO OFF
if isdir r:\temp set temp=r:\temp
echo    _admin: %_admin
echo _elevated: %_elevated
echo   _parent: %_parent
set WT=N
if defined WT_PROFILE_ID set WT=Y
if defined WT_SESSION set WT=Y
if %WT=Y echo Windows Terminal
ver
chcp
echo Font:
wmic os get caption, buildnumber, version, csdversion, OSArchitecture
echo %@regquery["HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DisplayVersion"]
wmic computersystem get manufacturer,model
resolution
ENDLOCAL

No doubt there are other things that can be added to the script,
but this is just for starters.

Running from PowerShell 5.1 in Windows Terminal;

1783435115280.webp


Running from TCC in Windows Terminal;

1783435193972.webp


Running from stand-alone TCC;

1783435250992.webp


I don't know how to get the font name and size without using a plugin,
so if anyone has a solution to that,
please post your solution.


Post #3 in this thread solves the font name and size without using a plugin.

Joe
 
Last edited:
Added _conpty to script;

Code:
@SETLOCAL
@ECHO OFF
if isdir r:\temp set temp=r:\temp
echo    _admin: %_admin
echo _elevated: %_elevated
echo   _parent: %_parent
echo   _conpty: %_conpty
set WT=N
if defined WT_PROFILE_ID set WT=Y
if defined WT_SESSION set WT=Y
if %WT=Y echo Windows Terminal
ver
chcp 
echo Font: 
wmic os get caption, buildnumber, version, csdversion, OSArchitecture
echo %@regquery["HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DisplayVersion"]
wmic computersystem get manufacturer,model
resolution
ENDLOCAL

Joe
 
Added FontName to script:

Code:
@SETLOCAL
@ECHO OFF
if isdir r:\temp set temp=r:\temp
echo    _admin: %_admin
echo _elevated: %_elevated
echo   _parent: %_parent
echo   _conpty: %_conpty
set WT=N
if defined WT_PROFILE_ID set WT=Y
if defined WT_SESSION set WT=Y
if %WT=Y echo Windows Terminal
ver
chcp 
echo Font:
Gosub FontName
pshell %_batchname:%@name[%_batchname].ps1
wmic os get caption, buildnumber, version, csdversion, OSArchitecture
echo %@regquery["HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DisplayVersion"]
wmic computersystem get manufacturer,model
resolution
ENDLOCAL
quit

:FontName
type <<- endtext > %_batchname:%@name[%_batchname].ps1
if (-not ('Win32test.ConsoleTest' -as [type])) {
    $defConsoleTest = @'
using System.Runtime.InteropServices;
using System;

namespace Win32test
{
    public static class ConsoleTest
    {
        [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
        extern static bool GetCurrentConsoleFontEx(
            IntPtr hConsoleOutput,
            bool bMaximumWindow,
            ref CONSOLE_FONT_INFOEX lpConsoleCurrentFont);

        private enum StdHandle
        {
            OutputHandle = -11
        }

        [DllImport("kernel32")]
        private static extern IntPtr GetStdHandle(StdHandle index);

        public static string GetFontInfo()
        {
            CONSOLE_FONT_INFOEX ConsoleFontInfo = new CONSOLE_FONT_INFOEX();
            ConsoleFontInfo.cbSize = (uint)Marshal.SizeOf(ConsoleFontInfo);

            GetCurrentConsoleFontEx(GetStdHandle(StdHandle.OutputHandle), false, ref ConsoleFontInfo);

            return string.Format("FaceName: {0}, FontFamily: {1}, FontWeight: {2}, FontSize: {3}x{4}",
                ConsoleFontInfo.FaceName,
                ConsoleFontInfo.FontFamily,
                ConsoleFontInfo.FontWeight,
                ConsoleFontInfo.dwFontSize.X,
                ConsoleFontInfo.dwFontSize.Y);
        }

        [StructLayout(LayoutKind.Sequential)]
        private struct COORD
        {
            public short X;
            public short Y;
            public COORD(short x, short y) { X = x; Y = y; }
        }

        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
        private struct CONSOLE_FONT_INFOEX
        {
            public uint cbSize;
            public uint nFont;
            public COORD dwFontSize;
            public int FontFamily;
            public int FontWeight;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
            public string FaceName;
        }
    }
}
'@
    Add-Type -TypeDefinition $defConsoleTest
}

[Win32test.ConsoleTest]::GetFontInfo()   
endtext
return

Output for FontName:
Code:
FaceName: IBM 3270, FontFamily: 54, FontWeight: 700, FontSize: 16x34

Joe
 
I've add a subroutine to TCCINFO.BTM that will take the users existing TCMD.INI file,
copy it away from the TCC home folder,
and remove personal info from TCMD.INI,
so that the TCMD.INI file can be attached to a forum message for @rconn to review.

Code:
@SETLOCAL
@ECHO OFF
if isdir r:\temp set temp=r:\temp

echo    _admin: %_admin %@char[9] %{which _admin}
echo _elevated: %_elevated %@char[9] %{which _elevated}
echo   _parent: %_parent
echo   _conpty: %_conpty %@char[9] %{which _conpty}
echo  _cmdspec: %_cmdspec 
echo     _ansi: %_ansi

:: _contype is from the MyWindows.dll plugin
:: https://charlesdye.net/plugins/mywindow.html
iff exist e:\utils\MyWindow.dll then
  if not plugin MyWindow plugin /l e:\utils\MyWindow.dll
  if isplugin _contype echo  _contype: %_contype
endiff
set WT=N
if defined WT_PROFILE_ID set WT=Y
if defined WT_SESSION set WT=Y
if %WT=Y echo Windows Terminal
ver
chcp 

:: Font is from the confont.dll plugin
:: https://charlesdye.net/plugins/confont.html
iff exist e:\utils\confont.dll then
  iff %WT ne Y then
    if not plugin ConFont plugin /l e:\utils\ConFont.dll
    if isplugin font echo Font: %{font}
  endiff
endiff

Gosub FontName
:: Rex added support for NTFS file streams in Version 36.50 for the PShell Command.
pshell %_batchname:%@name[%_batchname].ps1
wmic os get caption, buildnumber, version, csdversion, OSArchitecture
echo %@regquery["HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DisplayVersion"]
wmic computersystem get manufacturer,model
resolution

Gosub INIClean

iff exist %temp\tcmd.ini then
  echo %temp\tcmd.ini has been cleaned,
  echo and is ready to be attached to a forum message.
ENDLOCAL
quit

:FontName
type <<- endtext > %_batchname:%@name[%_batchname].ps1
if (-not ('Win32test.ConsoleTest' -as [type])) {
    $defConsoleTest = @'
using System.Runtime.InteropServices;
using System;

namespace Win32test
{
    public static class ConsoleTest
    {
        [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
        extern static bool GetCurrentConsoleFontEx(
            IntPtr hConsoleOutput,
            bool bMaximumWindow,
            ref CONSOLE_FONT_INFOEX lpConsoleCurrentFont);

        private enum StdHandle
        {
            OutputHandle = -11
        }

        [DllImport("kernel32")]
        private static extern IntPtr GetStdHandle(StdHandle index);

        public static string GetFontInfo()
        {
            CONSOLE_FONT_INFOEX ConsoleFontInfo = new CONSOLE_FONT_INFOEX();
            ConsoleFontInfo.cbSize = (uint)Marshal.SizeOf(ConsoleFontInfo);

            GetCurrentConsoleFontEx(GetStdHandle(StdHandle.OutputHandle), false, ref ConsoleFontInfo);

            return string.Format("FaceName: {0}, FontFamily: {1}, FontWeight: {2}, FontSize: {3}x{4}",
                ConsoleFontInfo.FaceName,
                ConsoleFontInfo.FontFamily,
                ConsoleFontInfo.FontWeight,
                ConsoleFontInfo.dwFontSize.X,
                ConsoleFontInfo.dwFontSize.Y);
        }

        [StructLayout(LayoutKind.Sequential)]
        private struct COORD
        {
            public short X;
            public short Y;
            public COORD(short x, short y) { X = x; Y = y; }
        }

        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
        private struct CONSOLE_FONT_INFOEX
        {
            public uint cbSize;
            public uint nFont;
            public COORD dwFontSize;
            public int FontFamily;
            public int FontWeight;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
            public string FaceName;
        }
    }
}
'@
    Add-Type -TypeDefinition $defConsoleTest
}

[Win32test.ConsoleTest]::GetFontInfo()   
endtext
return

:INIClean
copy "%_ininame" %temp

pushd
cdd %temp

rem Remove entries for privacy

iff exist %temp\tcmd.ini then
  echo Deleting MailAddress: %@iniwrite[%temp\tcmd.ini,4NT,MailAddress,]
  echo Deleting MailPassword: %@iniwrite[%temp\tcmd.ini,4NT,MailPassword,]
  echo Deleting MailAddress: %@iniwrite[%temp\tcmd.ini,4NT,MailUser,]
endiff

popd 
Return

Output from INIClean subroutine;

Code:
C:\Program Files\JPSoft\TCMD36\TCMD.INI => R:\temp\TCMD.INI
     1 file copied
Deleting MailAddress: 0
Deleting MailPassword: 0
Deleting MailAddress: 0
r:\temp\tcmd.ini has been cleaned,
and is ready to be attached to a forum message.


Other that deleting the noted items from TCMD.INI for privacy reasons,
are there any other items that should be removed from TCMD.INI for privacy reasons,
before attaching TCMD.INI to a forum message?

Joe
 
The contents of tmd.ini do not matter. If I completely remove tcmd.ini, the effect is the same. In my normal tcmd.ini I only have these LIST related settings:
INI:
ListBack=B Ctrl-PgUp
ListClipboard=Ctrl-B
ListContinue=C Ctrl-PgDn
ListDelete=Del
ListDown=Down
ListEdit=E
ListEnd=End
ListExit=Esc
ListFind=F
ListFindPrevious=Ctrl-N
ListFindRegex=R
ListFindRegexReverse=Ctrl-R
ListFindReverse=Ctrl-F
ListGoto=G
ListHex=X
ListHelp=F1
ListHexSpace=S
ListHighBit=H
ListHome=Home
ListInfo=I
ListLeft=Left
ListNext=N
ListNumber=L
ListOpen=O
ListPageDown=PgDn Space
ListPageLeft=Ctrl-Left
ListPageRight=Ctrl-Right
ListPageUp=PgUp
ListPrint=P
ListRefresh=F5
ListRight=Right
ListSave=Ins
ListTabSize=Tab
ListUnicode=U
ListUp=Up
ListWrap=W
 
Modified the code to indicate if TCC.EXE is not running in a Windows Terminal

Code:
@SETLOCAL
@ECHO OFF
if isdir r:\temp set temp=r:\temp

echo    _admin: %_admin %@char[9] %{which _admin}
echo _elevated: %_elevated %@char[9] %{which _elevated}
echo   _parent: %_parent
echo   _conpty: %_conpty %@char[9] %{which _conpty}
echo  _cmdspec: %_cmdspec 
echo     _ansi: %_ansi

:: start TCC /... to display DEBUG dialog boxes.

:: _contype is from the MyWindows.dll plugin
:: https://charlesdye.net/plugins/mywindow.html
iff exist e:\utils\MyWindow.dll then
  if not plugin MyWindow plugin /l e:\utils\MyWindow.dll
  if isplugin _contype echo  _contype: %_contype
endiff
set WT=N
if defined WT_PROFILE_ID set WT=Y
if defined WT_SESSION set WT=Y
if %WT=Y echo Windows Terminal
if %WT=N echo Not running in Windows Terminal
ver
chcp 

:: Font is from the confont.dll plugin
:: https://charlesdye.net/plugins/confont.html
iff exist e:\utils\confont.dll then
  iff %WT ne Y then
    if not plugin ConFont plugin /l e:\utils\ConFont.dll
    if isplugin font echo Font: %{font}
  endiff
endiff

Gosub FontName
:: Rex added support for NTFS file streams in Version 36.50 for the PShell Command.
pshell %_batchname:%@name[%_batchname].ps1
wmic os get caption, buildnumber, version, csdversion, OSArchitecture
echo %@regquery["HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DisplayVersion"]
wmic computersystem get manufacturer,model
resolution

Gosub INIClean

iff exist %temp\tcmd.ini then
  echo %temp\tcmd.ini has been cleaned,
  echo and is ready to be attached to a forum message.
ENDLOCAL
quit

:FontName
type <<- endtext > %_batchname:%@name[%_batchname].ps1
if (-not ('Win32test.ConsoleTest' -as [type])) {
    $defConsoleTest = @'
using System.Runtime.InteropServices;
using System;

namespace Win32test
{
    public static class ConsoleTest
    {
        [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
        extern static bool GetCurrentConsoleFontEx(
            IntPtr hConsoleOutput,
            bool bMaximumWindow,
            ref CONSOLE_FONT_INFOEX lpConsoleCurrentFont);

        private enum StdHandle
        {
            OutputHandle = -11
        }

        [DllImport("kernel32")]
        private static extern IntPtr GetStdHandle(StdHandle index);

        public static string GetFontInfo()
        {
            CONSOLE_FONT_INFOEX ConsoleFontInfo = new CONSOLE_FONT_INFOEX();
            ConsoleFontInfo.cbSize = (uint)Marshal.SizeOf(ConsoleFontInfo);

            GetCurrentConsoleFontEx(GetStdHandle(StdHandle.OutputHandle), false, ref ConsoleFontInfo);

            return string.Format("FaceName: {0}, FontFamily: {1}, FontWeight: {2}, FontSize: {3}x{4}",
                ConsoleFontInfo.FaceName,
                ConsoleFontInfo.FontFamily,
                ConsoleFontInfo.FontWeight,
                ConsoleFontInfo.dwFontSize.X,
                ConsoleFontInfo.dwFontSize.Y);
        }

        [StructLayout(LayoutKind.Sequential)]
        private struct COORD
        {
            public short X;
            public short Y;
            public COORD(short x, short y) { X = x; Y = y; }
        }

        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
        private struct CONSOLE_FONT_INFOEX
        {
            public uint cbSize;
            public uint nFont;
            public COORD dwFontSize;
            public int FontFamily;
            public int FontWeight;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
            public string FaceName;
        }
    }
}
'@
    Add-Type -TypeDefinition $defConsoleTest
}

[Win32test.ConsoleTest]::GetFontInfo()   
endtext
return

:INIClean
copy "%_ininame" %temp

pushd
cdd %temp

rem Remove entries for privacy

iff exist %temp\tcmd.ini then
  echo Deleting MailAddress: %@iniwrite[%temp\tcmd.ini,4NT,MailAddress,]
  echo Deleting MailPassword: %@iniwrite[%temp\tcmd.ini,4NT,MailPassword,]
  echo Deleting MailAddress: %@iniwrite[%temp\tcmd.ini,4NT,MailUser,]
endiff

popd 
Return

Joe
 
Modified the code to indicate if TCC.EXE is running in a TCMD Tab Window.

Code:
@SETLOCAL
@ECHO OFF
if isdir r:\temp set temp=r:\temp

echo    _admin: %_admin %@char[9] %{which _admin}
echo _elevated: %_elevated %@char[9] %{which _elevated}
echo   _parent: %_parent
echo   _conpty: %_conpty %@char[9] %{which _conpty}
echo  _cmdspec: %_cmdspec 
echo     _ansi: %_ansi
echo    _tctab: %_tctab %@if[%_tctab eq 1,Running in a TCMD Tab,Not running in a TCMD Tab]

:: start TCC /... to display DEBUG dialog boxes.

:: _contype is from the MyWindows.dll plugin
:: https://charlesdye.net/plugins/mywindow.html
iff exist e:\utils\MyWindow.dll then
  if not plugin MyWindow plugin /l e:\utils\MyWindow.dll
  if isplugin _contype echo  _contype: %_contype
endiff
set WT=N
if defined WT_PROFILE_ID set WT=Y
if defined WT_SESSION set WT=Y
if %WT=Y echo        WT: Windows Terminal
if %WT=N echo        WT: Not running in Windows Terminal
ver
chcp 

:: Font is from the confont.dll plugin
:: https://charlesdye.net/plugins/confont.html
iff exist e:\utils\confont.dll then
  iff %WT ne Y then
    if not plugin ConFont plugin /l e:\utils\ConFont.dll
    if isplugin font echo Font: %{font}
  endiff
endiff

Gosub FontName
:: Rex added support for NTFS file streams in Version 36.50 for the PShell Command.
iff exist %@name[%_batchname.ps1] pshell %_batchname:%@name[%_batchname].ps1
wmic os get caption, buildnumber, version, csdversion, OSArchitecture
echo %@regquery["HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DisplayVersion"]
wmic computersystem get manufacturer,model
resolution

Gosub INIClean

iff exist %temp\tcmd.ini then
  echo %temp\tcmd.ini has been cleaned,
  echo and is ready to be attached to a forum message.
ENDLOCAL
quit

:FontName
type <<- endtext > %_batchname:%@name[%_batchname].ps1
if (-not ('Win32test.ConsoleTest' -as [type])) {
    $defConsoleTest = @'
using System.Runtime.InteropServices;
using System;

namespace Win32test
{
    public static class ConsoleTest
    {
        [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
        extern static bool GetCurrentConsoleFontEx(
            IntPtr hConsoleOutput,
            bool bMaximumWindow,
            ref CONSOLE_FONT_INFOEX lpConsoleCurrentFont);

        private enum StdHandle
        {
            OutputHandle = -11
        }

        [DllImport("kernel32")]
        private static extern IntPtr GetStdHandle(StdHandle index);

        public static string GetFontInfo()
        {
            CONSOLE_FONT_INFOEX ConsoleFontInfo = new CONSOLE_FONT_INFOEX();
            ConsoleFontInfo.cbSize = (uint)Marshal.SizeOf(ConsoleFontInfo);

            GetCurrentConsoleFontEx(GetStdHandle(StdHandle.OutputHandle), false, ref ConsoleFontInfo);

            return string.Format("FaceName: {0}, FontFamily: {1}, FontWeight: {2}, FontSize: {3}x{4}",
                ConsoleFontInfo.FaceName,
                ConsoleFontInfo.FontFamily,
                ConsoleFontInfo.FontWeight,
                ConsoleFontInfo.dwFontSize.X,
                ConsoleFontInfo.dwFontSize.Y);
        }

        [StructLayout(LayoutKind.Sequential)]
        private struct COORD
        {
            public short X;
            public short Y;
            public COORD(short x, short y) { X = x; Y = y; }
        }

        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
        private struct CONSOLE_FONT_INFOEX
        {
            public uint cbSize;
            public uint nFont;
            public COORD dwFontSize;
            public int FontFamily;
            public int FontWeight;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
            public string FaceName;
        }
    }
}
'@
    Add-Type -TypeDefinition $defConsoleTest
}

[Win32test.ConsoleTest]::GetFontInfo()   
endtext
return

:INIClean
iff exist "%_ininame" copy "%_ininame" %temp
iff not exist "%_ininame" return

pushd
cdd %temp

rem Remove entries for privacy

iff exist %temp\tcmd.ini then
  echo Deleting MailAddress: %@iniwrite[%temp\tcmd.ini,4NT,MailAddress,]
  echo Deleting MailPassword: %@iniwrite[%temp\tcmd.ini,4NT,MailPassword,]
  echo Deleting MailAddress: %@iniwrite[%temp\tcmd.ini,4NT,MailUser,]
endiff

popd 
Return

Joe
 
Back
Top