1

I work with multiple Explorer Windows that use different user credentials and I was wondering if there is a way to set a static title for each window to be able to determine which one uses which user credentials, like window A title set to "user abc" – since the titles change to the currently opened directory which is rather confusing sometimes with multiple Windows open

I'm looking for as simple solution as possible, batch, VBScript, etc., something that can be easily ran from either a command line or a script file that doesn't need any compilation, conversion, or specific software installed, for example:

open explorer.exe title="custom title"

So far I wasn't able to find any scripts that could handle that - 3rd party applications are out of the question.

Not sure if it's even possible, tried to find anything for few days now to no avail.

double-beep
  • 5,031
  • 17
  • 33
  • 41
Jacob Hmm
  • 21
  • 2
  • Can't say I've ever seen an explorer window that had a title, third-party application or not. – SomethingDark Jan 12 '16 at 23:19
  • You might be interested in [tag:autohotkey]... – aschipfl Jan 12 '16 at 23:28
  • auto hotkey is a scripting language that has to be compiled as far as i know, so wouldnt help me out here unfortunately as for 3rd party apps, Window Title Changer can apparently change titles of any windows, but its an app, and therefore wont be able to use it – Jacob Hmm Jan 13 '16 at 06:59
  • 1
    Windows Explorer can be configured to display the full path in the title bar. That's about it. – Ansgar Wiechers Jan 13 '16 at 08:25
  • 1
    @AnsgarWiechers Possibly can through the Windows API but you can't call the Windows API through VBScript unless it's wrapped in a COM component. Think you would use the API call [`SetWindowText()`](https://msdn.microsoft.com/en-us/library/windows/desktop/ms633546(v=vs.85).aspx). If they are using VBA you can declare Windows API functions so should be possible. – user692942 Jan 13 '16 at 12:06
  • What are you using VBA, VBScript, Batch make your mind up. – user692942 Jan 13 '16 at 12:10
  • would be great if it is - i was also checking the setwindowtext() command, but could only find it being used in c or c++. If there is a way to make a vba that would refer to it, would be perfect. I could even go cazy and incorporate it in excel and make button macros to run the script to open any titled windows i want. If there is anyone who is able to write a script that uses SetWindowText() in VBA, please assist. – Jacob Hmm Jan 13 '16 at 19:21
  • @JacobHmm [this link](http://www.pinvoke.net/default.aspx/user32.setwindowtext) shows the VB signature for the declare to allow yo use it in VBA. – user692942 Jan 13 '16 at 19:59

2 Answers2

0

The title of a File Explorer Windows can be changed using PowerShell.

To get the handles of all explorer windows use this COM object.
stackoverflow - Powershell script to list all open Explorer windows

(New-Object -ComObject 'Shell.Application').Windows() | select Name,LocationName,HWND

To get the handle of the topmost File Explorer Window you can use
stackoverflow - Have File Explorer Current working Directory Passed to PowerShell Script

Add-Type -Namespace Util -Name WinApi  -MemberDefinition @'
  // Find a window by class name and optionally also title.
  // The TOPMOST matching window (in terms of Z-order) is returned.
  // IMPORTANT: To not search for a title, 
  // pass [NullString]::Value, not $null, to lpWindowName
  [DllImport("user32.dll")]
  public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
'@

$hwndTopMostFileExplorer = [Util.WinApi]::FindWindow(
  "CabinetWClass",     # the window class of interest
  [NullString]::Value  # no window title to search for
)

(New-Object -ComObject Shell.Application).Windows() |
  Where-Object hwnd -eq $hwndTopMostFileExplorer

To change the Title of your File Explorer of selection, use the appropriate handle.
The handle used in the example below is for the topmost Explorer Window.
Pete Hinchley: Changing Window Titles using PowerShell

Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;

public static class Win32 {
  [DllImport("User32.dll", EntryPoint="SetWindowText")]
  public static extern int SetWindowText(IntPtr hWnd, string strTitle);
}
"@

[Win32]::SetWindowText($hwndTopMostFileExplorer , 'My Custom Title')

Dennis
  • 871
  • 9
  • 29
-2

According to here its possible to do it for iexplorer (internet explorer) so by a blind guess it might be possible to do it the same way for explorer windows>run>regedit.exe HKEY_CURRENT_USER > Software > Microsoft > Windows > CurrentVersion > Explorer and a new data with string as value type and window title as value name

And by changing theme it is possible to achieve a same or maybe similar objective, everything explained here could be done with a batch script

Community
  • 1
  • 1
xDeathwing
  • 139
  • 13
  • 2
    unfortunately im not really looking to change the internet explorer window name, but windows explorer, so this doesnt help me out – Jacob Hmm Jan 13 '16 at 07:02
  • Plus "iexplorer" is incorrect if your talking about the EXE for Internet Explorer it's `iexplore.exe`, drop the `r`. – user692942 Jan 13 '16 at 12:04
  • I do know infact that iexplore.exe is correct but I tried to shorten internet explorer as iexplorer (so no kudos there for you my friend :/) also while the topic linked tells you about internet explorer.. I wrote 2 different ways (2nd one that works) which tell seperate things.. so please before giving negative votes, read my full answer my friend :) – xDeathwing Jan 13 '16 at 14:35
  • 1
    sorry to say, but as much as the statement might be true about internet explorer and how to set the tite for it - it is not what my question is about at all and changing window title isnt as easy as changing theme options at all either - deffinitely not for Windows Explorer windows. explorer.exe =/= iexplore (internet explorer) – Jacob Hmm Jan 13 '16 at 19:16
  • Not after *"kudos"* just don't see the point in using *"iexplorer"* it's unnecessary *(not a well known shortened description of Internet Explorer)*, what's wrong with IE? – user692942 Jan 14 '16 at 12:02
  • Well, its beacuse of the rythm that feels nice to me when red by my language's accent. IE otherwise sounds something like disgusting (especially e ending sometimes sounds like eww) so thats why I tried to use iexplorer.. also it fits apple's naming conventions.. i+stuff :) – xDeathwing Jan 14 '16 at 19:34