Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerToys New+ variable support in template filenames -- documentation related updates #5285

Open
wants to merge 16 commits into
base: docs
Choose a base branch
from
Open
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 59 additions & 1 deletion hub/powertoys/newplus.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: PowerToys New+ for Windows
description: A tool that enables you to create files and folders from a personalized set of templates, directly from the File Explorer context menu.
ms.date: 07/13/2024
ms.date: 01/25/2025
ms.topic: article
no-loc: [PowerToys, Windows, New+, New, NewPlus, Win]
---
Expand Down Expand Up @@ -44,4 +44,62 @@ The option enables you to toggle the display of filename extensions. When this o

The option enables you to toggle the display of starting digits, spaces and dots. When this option is toggled off (the default), a file named "1. filename" will be displayed as is. However, when this option is toggled on, the template will be displayed as "filename". This is useful when using digits, spaces, and dots at the beginning of filenames to control the display order of templates.

### Behavior

#### Replace variables in template filename

This setting causes supported variables in filenames, including in files within subfolders, to be replaced when the template is copied. The default setting of this option is enabled.

Note: Any invalid filename characters are replaced with spaces.

##### Examples

| Example template filename | Would on copy expand to |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Is it a "template filename" or a "file name template"?
  • I think a phrasing like "would" sounds too insecure. "Result" is simple and confident.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filename:
We are using "filename" in the New+ settings UI and also in the existing New+ documentation. Both filename and file name are valid but started with filename and prefer to be consistent throughout.

Updated to "Result"

| :--- | :--- |
|`$YYYY-$MM-%DD, $hh $mm $ss - $PARENT_FOLDER_NAME by %USERNAME%` | `2024-11-22, 12 08 54 - PowerShell project by cgaarden` |
|`File where variable value contains invalid characters %USERPROFILE%` | `File where variable value contains invalid characters C Users cgaarden` |

##### Date and time related variables

These date and time related variable patterns are the same as those used by PowerRename and are case-sensitive.

| Variable | Explanation |
| :--- | :--- |
| `$YYYY` | Year, represented by a full four or five digits, depending on the calendar used. |
| `$YY` | Year, represented only by the last two digits. A leading zero is added for single-digit years. |
| `$Y` | Year, represented only by the last digit. |
| `$MMMM` | Name of the month. |
| `$MMM` | Abbreviated name of the month. |
| `$MM` | Month, as digits with leading zeros for single-digit months. |
| `$M` | Month, as digits without leading zeros for single-digit months. |
| `$DDDD` | Name of the day of the week. |
| `$DDD` | Abbreviated name of the day of the week. |
| `$DD` | Day of the month, as digits with leading zeros for single-digit days. |
| `$D` | Day of the month, as digits without leading zeros for single-digit days. |
| `$hh` | Hours, with leading zeros for single-digit hours. |
| `$h` | Hours, without leading zeros for single-digit hours. |
| `$mm` | Minutes, with leading zeros for single-digit minutes. |
| `$m` | Minutes, without leading zeros for single-digit minutes. |
| `$ss` | Seconds, with leading zeros for single-digit seconds. |
| `$s` | Seconds, without leading zeros for single-digit seconds. |
| `$fff` | Milliseconds, represented by full three digits. |
| `$ff` | Milliseconds, represented only by the first two digits. |
| `$f` | Milliseconds, represented only by the first digit. |

##### Special variables

These special variables are case-sensitive, so they will only work when written exactly as shown here.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sentence can be shortened. Like, "Note: Case sensitive" should suffice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I agree - to me and you - yes :-) but I think there a lot of people who don't really know what case-sensitive/insensitive mean.


| Variable | Explanation |
| :--- | :--- |
| `$PARENT_FOLDER_NAME` | Expands to the name of the parent folder. |

##### Environment variables

These variables are case-insensitive, meaning you can write them in a mix of uppercase or lowercase.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same. Nit: to me, the word "write" sounds more like "handwriting", versus "type"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded slightly to hopefully avoid confusion


Each `%environment_variable%` in the file and folder names will be replaced with the value of the corresponding environment variable.

For instance, %USERNAME% will be replaced with the name of the current Windows user.

[!INCLUDE [install-powertoys.md](../includes/install-powertoys.md)]