Command Prompt & PowerShell open with different GUI when executed in different ways

Discussion, questions and support.
Post Reply
Message
Author
Forez
Posts: 535
Joined: 30.01.2016, 12:05
Location: In front of a PC monitor

Command Prompt & PowerShell open with different GUI when executed in different ways

#1 Post by Forez » 23.02.2021, 17:25

So I have been through this two topics

https://freecommander.com/forum/viewtop ... 23&p=35599
https://freecommander.com/forum/viewtop ... 20&p=35603

but they still do not answer to a peculiar question



Apparently on the drive C: with Windows 10 installed on has EXE files for the Command Prompt

Version "A"

Code: Select all

C:\Windows\system32\cmd.exe

Version "B"

Code: Select all

C:\Windows\SysWOW64\cmd.exe



I can setup two shortcut ways of executing them

Method #1
With a Favorite toolbar icon with its options set to

Code: Select all

Program or folder:
[PATH]\cmd.exe

Start folder:
[EMPTY]

Parameter:
/K "cd /d C:\"

[SELECTED OPTIONS:]
Enclose each selected item with "
With "Run as" dialog
Maximized



Method #2
With a LNK file with its options set to

Code: Select all

Target: [PATH]\cmd.exe
Start in: [PATH]
Run: Maximized
Advanced: Run as administrator


With each of these versions / methods I am getting the CMD with Administrator rights opened in >>C:\<< in a maximized form. So far so good



But if I change GUI settings in A-2 and B-2, for example set the font to blue and read, then the A-1 and B-1 will not be affected. In a matter of fact I can change in either A-1 or B-1 the font to green and get that green in both of them - with A-2 still retaining blue and B-2 still being red

In other words: when executing these two different versions of EXE file for CMD via LNK methods I am able to distinct them * with two different colors. But when I am running the supposedly very same EXE files for CMD via Favorite icon method then I get only one color which is a third color - and I would expect to be not able to do that at all as I should be seeing the same two previous colors from the LNK files

But I have checked all the versions / methods with the Task Manager and they all seem to be running in the end the

Code: Select all

C:\Windows\SysWOW64\cmd.exe
file. So when I wrote a moment ago * distinct them I was referring to them in theory, because in reality it is only one version of the EXE, with the other one

Code: Select all

C:\Windows\system32\cmd.exe
nowhere to be seen. And this is also true for running these EXE files not as Administrator - in that the also have their own unique color configurations and are shown in Task Manager with the same path




So this does not make any sense at all, because:

by executing two EXE versions I am able to store three different GUI settings for them in apparently some one config file [assigned to that one EXE which is always being run despite the version / method chosen] - and if I add another two [non-Administrator] versions the number of GUI increases from 3 to 5




So what is happening here? How is that even possible? Is FreeCommander somehow ignoring the paths - depending in the method chosen? Or is it the Windows that fools the FC and user later on by laying about what EXE is really being run - by showing everything under one

Code: Select all

C:\Windows\SysWOW64\cmd.exe
umbrella? The info available at https://freecommander.com/fchelpxe/en/F ... wsx64.html says:

Comments on FreeCommander XE 32-bit version.

Like all 32-bit programs on Windows x64, FreeCommander is subject to the following restrictions:
- 32-bit programs are not able to display the control panel.
- 32-bit programs show different contents for the folder "%windir%\system32" and its subfolders.
Notes:
- %windir% is a system variable that points to the Windows install folder - often: c:\Windows
- 32-bit programs are redirected from "%windir%\system32" to "%windir%\SysWOW64" automatically.


If FC is supposedly redirecting me to >>SysWOW64<< version, then why it is that I have 3 [5] different GUIs - and which GUI if for which?



And yes I have copied the LNK files [i.e. A-2 and B-2] to different locations and run them from Windows Explorer. And they still displayed their color [i.e. blue and red] while the third color remained for FreeCommander Favorite icons [i.e. A-1 and B-1]




As for the PowerShell

The Matrix situation is similar - if not the same. If needed I can indulge myself in writing it down in details - but I hope that the situation with CMD will be somehow unrevealed -thus talking extensively about PowerShell GUI will not be needed



I am using FreeCommander XE 2020 Build 840 32-bit public on Windows 10 Enterprise 20H2 19042.746

Karol
Posts: 813
Joined: 19.08.2007, 12:05

Re: Command Prompt & PowerShell open with different GUI when executed in different ways

#2 Post by Karol » 23.02.2021, 22:00

Write less, read more:

from https://freecommander.com/en/version-summary/
From Windows Vista X64 on the hidden alias “Sysnative” exists for the genuine “System32” folder. To access the genuine “%windir%\system32” folder “%windir%\sysnative” can be used. Under the menu item “Favorites → Favorites edit…” a new favorite can be added, with “%windir%\sysnative” in the input field “active panel”.

Another opportunity are symbolic links. The automatically redirection of folders is not active for 32 bit programs, if the program accesses the folder via a symbolic link. It is sufficient to define a symbolic link for the folder “%windir%\system32” to access the genuine “%windir%\system32” folder.

Forez
Posts: 535
Joined: 30.01.2016, 12:05
Location: In front of a PC monitor

Re: Command Prompt & PowerShell open with different GUI when executed in different ways

#3 Post by Forez » 23.02.2021, 22:26

I have noticed that virtually any BAT file I have, when running ignores completely all of those color GUI settings that I made for those [5] various versions

I also have noticed [with the help of HIPS feature of the free COMODO] that when I execute any BAT file, it asks for access to

C:\Windows\System32\conhost.exe

So I went to its location to run it [that file is invisible to FreeCommander - I had to use Windows Explorer to execute it by hand]. It opened yet another version of CMD - so I hoped that by changing its Properties I would affect all of the BAT files, thinking that it is this location where default settings are stored. Unfortunately nothing has changed - i.e. when I run this conhost.exe I get what I wanted [changed colors etc.] but run BAT files I still end up with default [white on black]

And what is more: I can change visuals for every of my BAT files - by changing Properties for every single window that shows. And that is also true for LNK files leading to BAT files, which I use to elevate some BATs to Administrator level: I can successively change the BAT file, but also override its Properties running it via a LNK created for it




So if it is impossible to change this hypothetical default CMD config file - then maybe I could make all of my BAT files to my likening by adding at their beginning some sub-script that would change their displayed appearance? Is still would have to do this for all of my files - but at least on my next operating system they would still look the same when run [aside from the LNK workarounds?]

And so: does anyone have such ready to use scripts for changing GUI of displayed Command Line [and PowerShell] window, that can be inserted into BATs?

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 17 guests