How to show a message box on Windows 10

Apps can show alerts when they need a user’s attention e.g., the ‘Do you want to save changes’ alert you try to close a Notepad file with unsaved changes. They can also show messages e.g. when a file has downloaded or it has been processed.

These messages are useful but they don’t have to come from an app. Users can show a custom message box on Windows 10 using a batch script, PowerShell script, or by running a command in Command Prompt or PowerShell. 

Need to show a toast notification? Use a PowerShell module.

Custom message box on Windows 10

A custom message box will have a title, a message, and a call to action button i.e., an OK button which will dismiss the message. 

First, decide if you want to use a script or if you want to run a command. Running a command is easier so we’ll go over the script method first.

1. Batch/PowerShell script to show message box

Follow the steps below to create the script.

  1. Open a new Notepad file (or use any text editor of your choice).
  2. Paste the following in the Notepad file.
@echo off

powershell -Command "& {Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show('My Message', 'Message title', 'OK', [System.Windows.Forms.MessageBoxIcon]::Information);}"
  1. If you intend to use a PowerShell script, remove the first line: @echo off.
  2. Edit the script as below:
    • Replace ‘My Message‘ with the message you want the message box to show.
    • Replace “Message Title” with the title of the message box you want.


@echo off

powershell -Command "& {Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show('Go to the reactor room', 'Reactor Meltdown', 'OK', [System.Windows.Forms.MessageBoxIcon]::Information);}"
  1. Save the file with the .bat extension for a batch script or the .ps1 extension for a PowerShell script.
  2. Run the script and the message box will appear.

2. Command Prompt or PowerShell – Message box

Showing a message box from the Command Prompt or from PowerShell is easy. You do not need admin rights to show the message box.

Command Prompt

  1. Open Command Prompt.
  2. Run the following command in it.
  3. Edit the command as below to set your custom message and title.
    • Replace ‘My Message’ with the message you want the message box to show.
    • Replace “Message Title” with the title you want the message box to have.
@echo off

powershell -Command "& {Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show('My Message', 'Message Title', 'OK', [System.Windows.Forms.MessageBoxIcon]::Information);}"


  1. Open PowerShell.
  2. Run the following command.
  3. Edit the command to add your own message and title.
    • Replace ‘My Message’ with the message you want the message box to show.
    • Replace “Message Title” with the title you want the message box to have.
powershell -Command "& {Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show('My Message', 'Message Title', 'OK', [System.Windows.Forms.MessageBoxIcon]::Information);}"

The post How to show a message box on Windows 10 appeared first on AddictiveTips.

How to create a PowerShell profile on Windows 10

PowerShell, like many command lines, lets you create a profile. The profile allows you to customize the environment that you get when you open it. Out of the box, PowerShell does not have a profile file on Windows 10. This is because the file is basically a script that runs when you open PowerShell and by default, scripts are disabled as a security measure. Here’s how you can create a PowerShell profile on Windows 10.

You will need admin rights to create a PowerShell profile.

Create PowerShell profile

Open PowerShell with admin rights. If you want, you can check if you might have created a profile for PowerShell before and simply forgotten about it. To check, run the following command;

Test-path $profile

If the command returns ‘True’, you already have a profile. You can access it by running the command below;

notepad $profile

If the command returns ‘False’, then you do not have a PowerShell profile. You can create it with the command below.

New-item –type file –force $profile

When you run this command a new Notepad file will open. This is your PowerShell profile file and you can start editing it. You do have one more thing to do; change the execution policy in PowerShell. This will allow the file to be loaded when you open PowerShell.

Run the command below and close PowerShell

Set-ExecutionPolicy RemoteSigned

By default, the profile file will be created in the following location.


This profile is for the current user only. If you have another user configured on the same system, they will not have access to it and running the test command when signed in with the other user account will return a ‘False’.

Editing PowerShell profile

Any time you want to edit the profile file, you can use the following command to open it. As for what edits to make, those are entirely up to you. The profile isn’t needed to use PowerShell but setting one up might make  daily tasks easier for you, if you use PowerShell a lot.

notepad $profile

There are a few useful things you can add to the profile, e.g., display the current time and date when you open PowerShell, or give the PowerShell window a specific title, among other things. You can also add scripts to the profile. This will allow you to run them more easily when you’re working in PowerShell. The profile can also be used to modify the look of the PowerShell window extensively.

In the event that you enter something incorrect in the file, it simply won’t load. It is unlikely that a profile file will cause problems in PowerShell.

The post How to create a PowerShell profile on Windows 10 appeared first on AddictiveTips.

How to update to PowerShell 7.0 on Windows 10

PowerShell 7.0 is available on the stable release. Windows 10 force-updates users to a lot of things e.g., Chromium Edge but, it will not force update you to PowerShell 7.0, not yet anyway. If you’d like to update to PowerShell 7.0, you can do one of two things; run the installer on its Github page, or install it from PowerShell.

Update to PowerShell

If you want to update to PowerShell via the installer, visit the PowerShell Github page. Go to the Releases tab and look for the file with the MSI file extension. Make sure you download the 64-bit version if you’re running 64-bit Windows. Run the installer like you would any other installer and it will take care of everything for you.

If you’d like to update PowerShell from inside the app itself, open it with admin rights. Run the following command. You do not need to modify the command in any way. Run it as it is.

iex "& { $(irm } -UseMSI"

The command will first download the installer from the PowerShell Github page. For a while, it may seem like it isn’t doing anything but it is downloading the file.

You will then be walked through the set-up which is going to be the same that you get with the MSI file. You can choose to add PowerShell to the context menu during the update process. Allow the installation to complete. It won’t take more than a few minutes on a moderately powerful system. On slower systems, it might take up to fifteen minutes.

When the update is complete, you will see a new PowerShell window and at the top, the version number will be updated.

If you’d like to know what’s new in PowerShell, you can go to the Github page where the changes have been listed. The changes don’t indicate a change that might impact how you work with it. There’s nothing that you will need to tweak in any PowerShell script to make it compatible with PowerShell 7.0. The update does have new features but they add functionality to existing features and expand on some of PowerShell’s best commandlets.

If you need to run the older version of PowerShell i.e., 5, you can run the following command in the run box (tap Win+R to open the run box).

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Version 5

You can change the number at the end from 5 to 2 to run PowerShell 2.0. PowerShell 7.0 is installed alongside PowerShell 5. To open PowerShell 7, search for it in Windows search, or go through the apps’ list in the Start menu. It has a different icon than PowerShell 5 and should be easy to find.

The post How to update to PowerShell 7.0 on Windows 10 appeared first on AddictiveTips.

How to fix the font not changing in PowerShell on Windows 10

PowerShell lets you customize the font that it displays text in. It has a few specific fonts that you can choose from so you don’t have your entire fonts library at your disposal but these fonts are meant to work with a terminal which not all fonts are. Changing the font is easy and whatever you select can be set as the default font in PowerShell. If you’re trying to change the default font, and it won’t change, you might wonder what you’re doing wrong. This problem is actually a problem with the font you’re selecting.

Fix the font not changing in PowerShell

You can change the font that PowerShell uses by right-clicking the title bar and going to Properties or Default. There’s a Font tab in the window that opens where you can select a font and its size. If the changes you’re making on this window are not sticking i.e., PowerShell won’t remember them the next time you open the app, you will have to select a different font. When you do, PowerShell will remember it. This could be a problem with any font so try whichever one works and go with that. You can also install other fonts but make sure they will work with PowerShell before you install them.

To fix the font itself, you might have to download and install it all over again. It’s hard to say what might cause the problem with the font. When I had this problem, the font worked fine in other apps and PowerShell was able to use it for the current session. It only failed to use it when I quit the app and ran it again.

There’s also the fact that the font may not be available for download. These fonts tend to come pre-installed so you can’t go to popular font repositories and get them from there. What you can do is, if you have access to another Windows 10 PC, you can export the font from the other system and install it on the one you’re having PowerShell trouble with. It might work.

Another trick that’s worth trying is running PowerShell with admin rights and then changing its font. Strictly speaking, you don’t need admin rights to customize the look of PowerShell but it’s possible a problem with the font, now requires that you can change it only when you have admin access in PowerShell.

This does seem to be a recurring problem in PowerShell and it almost always turns out to be a problem with the font.

The post How to fix the font not changing in PowerShell on Windows 10 appeared first on AddictiveTips.

How to always run Command Prompt and PowerShell as Admin on Windows 10

Command Prompt and PowerShell can be run with admin rights, and with normal user rights. It goes without saying that if you run either of these command lines with admin rights, you can execute higher-level commands. With normal user rights, the commands that you can execute in either Command Prompt or PowerShell are tame. In many cases, you might even be blocked from running scripts. If you often need to open either or both these apps with admin rights and would like to skip using the context menu to do it, you can have Command Prompt and PowerShell always run as admin.


This trick will work for a specific shortcut to Command Prompt and PowerShell. You must always use that shortcut to open these apps. Any other shortcut that you use or any other method that you use to open them will not result in them opening with admin rights. While, in theory, you can change this behavior for any and all instances of Command Prompt and PowerShell, it isn’t a good idea to do so since it will involve taking ownership of the EXEs for both apps, and that may lead to additional problems down the line.

To keep it simple, either pin Command Prompt and/or PowerShell to the Start Menu or, pin them to the taskbar.

Run Command Prompt as Admin

If you’ve pinned Command Prompt to the Start menu, right-click the tile and go to More>Open File Location. Right-click the Command Prompt shortcut that opens in a new folder. If you have a simple desktop shortcut, you can just right-click it provided you will always be using that shortcut to open Command Prompt.

Go to the Shortcut tab, and click Advanced. Select the ‘Run as administrator’ option, and click OK. Now, the next time you use this shortcut or tile to open Command Prompt, it will open with admin rights. You will still see the UAC prompt.

Run PowerShell as Admin

To always open PowerShell as admin, you will use more or less the same method that you did for Command Prompt. Locate the shortcut that you want to use to open PowerShell. Right-click it and select Properties from the context menu. Go to the Shortcut tab and click the Advanced button. Select the ‘Run as administrator’ option, and click OK, and then Apply. That’s all you need to do. Every time you use that same shortcut to open PowerShell, it will open with admin rights. You will still get the UAC prompt before the app actually opens.

The post How to always run Command Prompt and PowerShell as Admin on Windows 10 appeared first on AddictiveTips.