#set font source location
$FontFolder = "FONT LOCATION"
$FontItem = Get-Item -Path $FontFolder
#go through all folders in source and list all fon, otf, ttc and ttf files
$FontList = Get-ChildItem -Path "$FontItem\*" -Include ('*.fon','*.otf','*.ttc','*.ttf') -Recurse
foreach ($Font in $FontList) {
Write-Host 'Installing font -' $Font.BaseName
Copy-Item $Font "C:\Windows\Fonts"
#register font for all users
New-ItemProperty -Name $Font.BaseName -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Fonts" -PropertyType string -Value $Font.name
}
In the original script I need to set the full path of the folder where the fonts are, and if I copy this folder to another drive I have to update the path before running it, but what I need and want is for it to recognize the folder where it is being executed without me having to set the path, as happens with a batch script that starts with the command cd /d “%~dp0”, like the one below that I use to install the Notepad++:
mode con lines=30 cols=70
@ECHO off
cd /d "%~dp0"
cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )
cls
echo.
@echo ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
@echo ßß ßß
@echo ßß S O F T E H A R D S O L U T I O N S ßß
@echo ßß ßß
@echo ßß ßßßß ßßßß ßß ßß ßßßßßß ßßßßßß ßß
@echo ßß ßß ßß ßß ßß ßß ßßß ßß ßß ßß ßß
@echo ßß ßß ßß ßß ßß ßß ßß ßß ßß ßß
@echo ßß ßßßß ßßßß ßß ßß ßß ßßßßßß ßß ßß ßß
@echo ßß ßßßß ßßßß ßß ßß ßß ßß ßß ßß ßß
@echo ßß ßß ßß ßß ßß ßß ßß ßß ßß ßß
@echo ßß ßß ßß ßß ßß ßß ßß ßß ßß ßß ßß ßß
@echo ßß ßßßß ßßßß ßß ßß ßß ßß ßßßßßß ßß
@echo ßß ßß
@echo ßß I N F O R M A T I C A ßß
@echo ßß ßß
@echo ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
@CHCP 1252 >NUL
@Title Silent installation of Notepad++ software version 64-bit..
echo.
echo. We are starting the silent installation of the software
echo.
echo. "Notepad++ 64-bit"
echo.
echo. When the installation is complete
echo. this message will disappear and the application
echo. will start so you can configure it before using it.
echo.
@echo OFF
FOR %%i IN ("npp*.exe") DO Set FileName="%%i"
%FileName% /S
echo. Installation completed successfully - Starting Notepad Plus Plus 64-bit!
@Start explorer.exe "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Notepad++.lnk"
timeout /t 4
exit
I search for the equivalent “cd /d “%~dp0″” command and I just found this “$PSScriptRoot”, did anyone knows if this will solve my problem?
Thanks in advance for any help.
The script makes life easier.
As a developer, I often install new fonts and configure the font family name in the IDE.
Some fonts’ family names are not directly visible and cause some trouble. (see this post on Reddit)
On windows, it’s easy to get all installed fonts’ family names.
Here is the code:
To use regex:
> Get-Fonts -regex "Nerd"
BlexMono Nerd Font
BlexMono Nerd Font Mono
Cousine Nerd Font
Cousine Nerd Font Mono
DroidSansMono Nerd Font
DroidSansMono Nerd Font Mono
GoMono Nerd Font
GoMono Nerd Font Mono
Hack Nerd Font
Hack Nerd Font Mono
ProFontIIx Nerd Font
ProFontIIx Nerd Font Mono
ProFontWindows Nerd Font
ProFontWindows Nerd Font Mono
Ubuntu Nerd Font
Ubuntu Nerd Font Mono
UbuntuCondensed Nerd Font
UbuntuCondensed Nerd Font Mono
📓 To use the font families whose names contain spaces, it’s usually required to quote the font family name in the configuration.
Scripts/Uninstall-Font.ps1
#Requires -Version 3.0
In the past I’ve created a blog post about managing the default fonts for Outlook. Someone replied to this post asking if this is also possible for the new Outlook client. This led to some investigations and this blogpost.
The documentation currently states that it only applies to Outlook Web. This is not true. Some settings do work for the new Outlook client. For example the default font and font-size setting.
Change the default font and font-size

- Connect to ExchangeOnline via Powershell
Import-Module ExchangeOnlineManagement Connect-ExchangeOnline -UserPrincipalName <UPN>
2. Change the font and font-size
Set-MailboxMessageConfiguration -Identity username@domain.com -DefaultFontName Calibri -DefaultFontSize 11
Restart the new Outlook client and verify your changes.

Change the default font and size for all mailboxes
# Query all the mailboxes $Mailboxes = Get-Mailbox -ResultSize Unlimited # Loop through each mailbox foreach ($mailbox in $mailboxes) { # Apply desired settings Set-MailboxMessageConfiguration -Identity $mailbox.Identity -DefaultFontName Calibri -DefaultFontSize 11 }
How can we programmatically alter the PowerShell console settings in Windows 10?
- Font size 18
- Screen Buffer Size 9999
- Window Size 140
- Window Height 32
It sounds like this should be very simple to do, but I have not found a way yet.
Initially, this seemed like a pathway to doing it but cannot get it to work:
$fontSize = 18
$screenBufferSize = 9999
$windowSize = 140
$windowHeight = 32
function Set-ConsoleSettings {
param (
[int]$FontSize,
[int]$ScreenBufferSize,
[int]$WindowSize,
[int]$WindowHeight
)
$font = New-Object System.Drawing.Font("Consolas", $FontSize)
$host.UI.RawUI.GetType().GetProperty("FontSize").SetValue($host.UI.RawUI, $font.Size, $null)
$host.UI.RawUI.BufferSize = New-Object Management.Automation.Host.Size($ScreenBufferSize, $WindowSize)
$host.UI.RawUI.WindowSize = New-Object Management.Automation.Host.Size($WindowSize, $WindowHeight)
}
# Change regular (non-admin) PowerShell console
Set-ConsoleSettings -FontSize $fontSize -ScreenBufferSize $screenBufferSize -WindowSize $windowSize -WindowHeight $windowHeight
# Change elevated (admin) PowerShell console
Start-Process powershell.exe -ArgumentList "-NoProfile -Command Set-ConsoleSettings -FontSize $fontSize -ScreenBufferSize $screenBufferSize -WindowSize $windowSize -WindowHeight $windowHeight" -Verb RunAs
Alternatively, maybe creating a custom shortcut with the settings defined in it, and then pinning that to the Taskbar could be a solution:
# Define the desired settings
$fontSize = 18
$screenBufferSize = 9999
$windowSize = 140
$windowHeight = 32
# Create a PowerShell shortcut with the desired font size
$shortcutPath = "$env:USERPROFILE\Desktop\CustomPowerShell.lnk"
$shell = New-Object -ComObject WScript.Shell
$shortcut = $shell.CreateShortcut($shortcutPath)
$shortcut.TargetPath = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe"
$shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `$host.UI.RawUI.FontSize=$fontSize; `$host.UI.RawUI.BufferSize=New-Object Management.Automation.Host.Size($screenBufferSize, $windowSize); `$host.UI.RawUI.WindowSize=New-Object Management.Automation.Host.Size($windowSize, $windowHeight)"
$shortcut.Save()
Write-Host "Custom PowerShell shortcut created on desktop."
Again, this fails.
I’m not really looking for “install Windows Terminal” as an answer as, although I love Windows Terminal, this is about configuring out of the box Windows so these settings should be something that I can do within an autounattend.xml to distribute standardised settings (and in any case, Windows Terminal is installed by default in Windows 11 I think).