From b41b3cd01a353945f8053a14f817f6447f3d99a4 Mon Sep 17 00:00:00 2001 From: Christian Gaarden Gaardmark Date: Mon, 25 Nov 2024 19:22:26 -0800 Subject: [PATCH 01/13] Added initial variable support to NewPlus --- hub/powertoys/newplus.md | 54 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/hub/powertoys/newplus.md b/hub/powertoys/newplus.md index f908a93f06..004204a517 100644 --- a/hub/powertoys/newplus.md +++ b/hub/powertoys/newplus.md @@ -44,4 +44,58 @@ 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. +### Filenaming options + +#### Expand variables in filenames + +With this option on (the default) certain variables in filenames will expand when the template file is copied. Any non-valid-filename charactors are replaced with spaces. + +##### Examples + +| Example template filename | Would on copy expand to | +| :--- | :--- | +|`$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 charactors %USERPROFILE%` | `File where variable value contains invalid charactors C Users cgaarden` | + +##### Date and time related variables + +Note these variable patterns are the same as for PowerRename and are case-sensitive. + +| Variable pattern | 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 + +Note these special variables are case-sensitive, so they will only work when written exactly as shown here. + +| Special variable | Explanation | +| :--- | :--- | +| `$PARENT_FOLDER_NAME` | will expand to the name of the parent folder. | + +##### Environment variables + +Note these variables are case-insensitive, so you can write them in upper or lowercase, as you prefer. + +* `%environment_variable%`, will get replaced by the value of that environment variable. + [!INCLUDE [install-powertoys.md](../includes/install-powertoys.md)] From 0fe7113f5ada8c59c71b370b49cfc61bd1483941 Mon Sep 17 00:00:00 2001 From: Christian Gaarden Gaardmark Date: Sat, 25 Jan 2025 14:09:49 -0800 Subject: [PATCH 02/13] New+ changes related to support for variables in template filenames --- hub/powertoys/newplus.md | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/hub/powertoys/newplus.md b/hub/powertoys/newplus.md index 004204a517..c1582dde9e 100644 --- a/hub/powertoys/newplus.md +++ b/hub/powertoys/newplus.md @@ -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] --- @@ -34,7 +34,7 @@ Template objects in the "Templates" folder can be files, folders, or shortcuts. After the enablement toggle, the New+ Templates location setting is likely the most interesting one. By default, the template location is in your local app data folder, specifically at `%localappdata%\Microsoft\PowerToys\NewPlus\Templates`. However, these templates will not roam with you across devices. If you want a common set of templates across devices, a popular option is to change the template location to a folder that is synced with a cloud drive, such as OneDrive. This way, you can access your templates from any device. -### Display options +### Display options #### Hide template filename extensions @@ -44,24 +44,26 @@ 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. -### Filenaming options +### Behavior -#### Expand variables in filenames +#### Replace variables in template filename -With this option on (the default) certain variables in filenames will expand when the template file is copied. Any non-valid-filename charactors are replaced with spaces. +With this option on (the default) supported variables in filenames, including in files within subfolders, will get replaced when the template is copied. -##### Examples +Note: Any non-valid-filename characters are replaced with spaces. + +##### Examples | Example template filename | Would on copy expand to | | :--- | :--- | |`$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 charactors %USERPROFILE%` | `File where variable value contains invalid charactors C Users cgaarden` | +|`File where variable value contains invalid characters %USERPROFILE%` | `File where variable value contains invalid characters C Users cgaarden` | ##### Date and time related variables -Note these variable patterns are the same as for PowerRename and are case-sensitive. +These date and time related variable patterns are the same as for PowerRename and are case-sensitive. -| Variable pattern | Explanation | +| 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. | @@ -86,16 +88,18 @@ Note these variable patterns are the same as for PowerRename and are case-sensit ##### Special variables -Note these special variables are case-sensitive, so they will only work when written exactly as shown here. +These special variables are case-sensitive, so they will only work when written exactly as shown here. -| Special variable | Explanation | +| Variable | Explanation | | :--- | :--- | | `$PARENT_FOLDER_NAME` | will expand to the name of the parent folder. | ##### Environment variables -Note these variables are case-insensitive, so you can write them in upper or lowercase, as you prefer. +These variables are case-insensitive, meaning you can write them in a mix of uppercase or lowercase. + +Each `%environment_variable%` in the file and folder name, will get replaced by the value of that environment variable. -* `%environment_variable%`, will get replaced by the value of that environment variable. +For instance, %USERNAME% will get replaced with the name of the current Windows user. [!INCLUDE [install-powertoys.md](../includes/install-powertoys.md)] From f90f9ac4f942c37bcad6c6c59846af718ff9ac64 Mon Sep 17 00:00:00 2001 From: Christian Gaarden Gaardmark Date: Mon, 27 Jan 2025 17:00:23 -0800 Subject: [PATCH 03/13] Update hub/powertoys/newplus.md Co-authored-by: Alvin Ashcraft <73072+alvinashcraft@users.noreply.github.com> --- hub/powertoys/newplus.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hub/powertoys/newplus.md b/hub/powertoys/newplus.md index c1582dde9e..1a91107ed1 100644 --- a/hub/powertoys/newplus.md +++ b/hub/powertoys/newplus.md @@ -48,7 +48,7 @@ The option enables you to toggle the display of starting digits, spaces and dots #### Replace variables in template filename -With this option on (the default) supported variables in filenames, including in files within subfolders, will get replaced when the template is copied. +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 non-valid-filename characters are replaced with spaces. From 77db49d8a8153e180ddc528e57a40777082f77ae Mon Sep 17 00:00:00 2001 From: Christian Gaarden Gaardmark Date: Mon, 27 Jan 2025 17:00:40 -0800 Subject: [PATCH 04/13] Update hub/powertoys/newplus.md Co-authored-by: Alvin Ashcraft <73072+alvinashcraft@users.noreply.github.com> --- hub/powertoys/newplus.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hub/powertoys/newplus.md b/hub/powertoys/newplus.md index 1a91107ed1..4c92bd0ff8 100644 --- a/hub/powertoys/newplus.md +++ b/hub/powertoys/newplus.md @@ -50,7 +50,7 @@ The option enables you to toggle the display of starting digits, spaces and dots 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 non-valid-filename characters are replaced with spaces. +Note: Any invalid filename characters are replaced with spaces. ##### Examples From ea3a0209e68ef67034f067a98cb11351591b22d7 Mon Sep 17 00:00:00 2001 From: Christian Gaarden Gaardmark Date: Mon, 27 Jan 2025 17:00:59 -0800 Subject: [PATCH 05/13] Update hub/powertoys/newplus.md Co-authored-by: Alvin Ashcraft <73072+alvinashcraft@users.noreply.github.com> --- hub/powertoys/newplus.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hub/powertoys/newplus.md b/hub/powertoys/newplus.md index 4c92bd0ff8..b91f4c3697 100644 --- a/hub/powertoys/newplus.md +++ b/hub/powertoys/newplus.md @@ -61,7 +61,7 @@ Note: Any invalid filename characters are replaced with spaces. ##### Date and time related variables -These date and time related variable patterns are the same as for PowerRename and are case-sensitive. +These date and time related variable patterns are the same as those used by PowerRename and are case-sensitive. | Variable | Explanation | | :--- | :--- | From 835e826f39f6c9679cf38fa5507fa3cff8985c7b Mon Sep 17 00:00:00 2001 From: Christian Gaarden Gaardmark Date: Mon, 27 Jan 2025 17:01:11 -0800 Subject: [PATCH 06/13] Update hub/powertoys/newplus.md Co-authored-by: Alvin Ashcraft <73072+alvinashcraft@users.noreply.github.com> --- hub/powertoys/newplus.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hub/powertoys/newplus.md b/hub/powertoys/newplus.md index b91f4c3697..f2a0eeace9 100644 --- a/hub/powertoys/newplus.md +++ b/hub/powertoys/newplus.md @@ -92,7 +92,7 @@ These special variables are case-sensitive, so they will only work when written | Variable | Explanation | | :--- | :--- | -| `$PARENT_FOLDER_NAME` | will expand to the name of the parent folder. | +| `$PARENT_FOLDER_NAME` | Expands to the name of the parent folder. | ##### Environment variables From 55c71ef455f5d814848965bcd610b63e7cdd0629 Mon Sep 17 00:00:00 2001 From: Christian Gaarden Gaardmark Date: Mon, 27 Jan 2025 17:01:30 -0800 Subject: [PATCH 07/13] Update hub/powertoys/newplus.md Co-authored-by: Alvin Ashcraft <73072+alvinashcraft@users.noreply.github.com> --- hub/powertoys/newplus.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hub/powertoys/newplus.md b/hub/powertoys/newplus.md index f2a0eeace9..e89aa1ec2f 100644 --- a/hub/powertoys/newplus.md +++ b/hub/powertoys/newplus.md @@ -98,7 +98,7 @@ These special variables are case-sensitive, so they will only work when written These variables are case-insensitive, meaning you can write them in a mix of uppercase or lowercase. -Each `%environment_variable%` in the file and folder name, will get replaced by the value of that environment variable. +Each `%environment_variable%` in the file and folder names will be replaced with the value of the corresponding environment variable. For instance, %USERNAME% will get replaced with the name of the current Windows user. From 00321c9d3ccdbd92af596889656d7a0760ead091 Mon Sep 17 00:00:00 2001 From: Christian Gaarden Gaardmark Date: Mon, 27 Jan 2025 17:01:42 -0800 Subject: [PATCH 08/13] Update hub/powertoys/newplus.md Co-authored-by: Alvin Ashcraft <73072+alvinashcraft@users.noreply.github.com> --- hub/powertoys/newplus.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hub/powertoys/newplus.md b/hub/powertoys/newplus.md index e89aa1ec2f..ae1116b08f 100644 --- a/hub/powertoys/newplus.md +++ b/hub/powertoys/newplus.md @@ -100,6 +100,6 @@ These variables are case-insensitive, meaning you can write them in a mix of upp Each `%environment_variable%` in the file and folder names will be replaced with the value of the corresponding environment variable. -For instance, %USERNAME% will get replaced with the name of the current Windows user. +For instance, %USERNAME% will be replaced with the name of the current Windows user. [!INCLUDE [install-powertoys.md](../includes/install-powertoys.md)] From ed9b5cc97a31b3fc8a05dda4804dc7fb6e4896b3 Mon Sep 17 00:00:00 2001 From: Christian Gaarden Gaardmark Date: Mon, 27 Jan 2025 17:06:16 -0800 Subject: [PATCH 09/13] Removed unnecessary bookmarks Removed unnecessary bookmarks in headings based on feedback (thank you!) --- hub/powertoys/newplus.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hub/powertoys/newplus.md b/hub/powertoys/newplus.md index ae1116b08f..d9ffc42659 100644 --- a/hub/powertoys/newplus.md +++ b/hub/powertoys/newplus.md @@ -34,7 +34,7 @@ Template objects in the "Templates" folder can be files, folders, or shortcuts. After the enablement toggle, the New+ Templates location setting is likely the most interesting one. By default, the template location is in your local app data folder, specifically at `%localappdata%\Microsoft\PowerToys\NewPlus\Templates`. However, these templates will not roam with you across devices. If you want a common set of templates across devices, a popular option is to change the template location to a folder that is synced with a cloud drive, such as OneDrive. This way, you can access your templates from any device. -### Display options +### Display options #### Hide template filename extensions @@ -44,15 +44,15 @@ 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 +### Behavior -#### Replace variables in template filename +#### 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 +##### Examples | Example template filename | Would on copy expand to | | :--- | :--- | From 347a0a85401ac0c9587f0f0d0f15202d69128f0b Mon Sep 17 00:00:00 2001 From: Christian Gaarden Gaardmark Date: Mon, 27 Jan 2025 17:06:16 -0800 Subject: [PATCH 10/13] Removed unnecessary bookmarks Removed unnecessary bookmarks in headings based on feedback (thank you!) --- hub/powertoys/newplus.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hub/powertoys/newplus.md b/hub/powertoys/newplus.md index ae1116b08f..d9ffc42659 100644 --- a/hub/powertoys/newplus.md +++ b/hub/powertoys/newplus.md @@ -34,7 +34,7 @@ Template objects in the "Templates" folder can be files, folders, or shortcuts. After the enablement toggle, the New+ Templates location setting is likely the most interesting one. By default, the template location is in your local app data folder, specifically at `%localappdata%\Microsoft\PowerToys\NewPlus\Templates`. However, these templates will not roam with you across devices. If you want a common set of templates across devices, a popular option is to change the template location to a folder that is synced with a cloud drive, such as OneDrive. This way, you can access your templates from any device. -### Display options +### Display options #### Hide template filename extensions @@ -44,15 +44,15 @@ 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 +### Behavior -#### Replace variables in template filename +#### 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 +##### Examples | Example template filename | Would on copy expand to | | :--- | :--- | From 8b63d673ed0e936a8354240fad3b5e8e61befa5f Mon Sep 17 00:00:00 2001 From: Christian Gaarden Gaardmark Date: Thu, 13 Feb 2025 20:08:03 -0800 Subject: [PATCH 11/13] Implemented PR feedback --- hub/powertoys/newplus.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hub/powertoys/newplus.md b/hub/powertoys/newplus.md index d9ffc42659..c1bcd461c3 100644 --- a/hub/powertoys/newplus.md +++ b/hub/powertoys/newplus.md @@ -54,7 +54,7 @@ Note: Any invalid filename characters are replaced with spaces. ##### Examples -| Example template filename | Would on copy expand to | +| Example template filename | 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` | @@ -88,7 +88,7 @@ These date and time related variable patterns are the same as those used by Powe ##### Special variables -These special variables are case-sensitive, so they will only work when written exactly as shown here. +These special variables are case-sensitive, so they will only work when used in the filename exactly as shown here. | Variable | Explanation | | :--- | :--- | @@ -96,7 +96,7 @@ These special variables are case-sensitive, so they will only work when written ##### Environment variables -These variables are case-insensitive, meaning you can write them in a mix of uppercase or lowercase. +These variables are case-insensitive, meaning you use them in the filename in a mix of uppercase or lowercase. Each `%environment_variable%` in the file and folder names will be replaced with the value of the corresponding environment variable. From 67fce042c38599ed4f1f7268024b260502219d55 Mon Sep 17 00:00:00 2001 From: Christian Gaarden Gaardmark Date: Tue, 25 Feb 2025 17:13:17 -0800 Subject: [PATCH 12/13] Update newplus.md Corrected %DD to $DD example --- hub/powertoys/newplus.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hub/powertoys/newplus.md b/hub/powertoys/newplus.md index c1bcd461c3..922420722b 100644 --- a/hub/powertoys/newplus.md +++ b/hub/powertoys/newplus.md @@ -56,7 +56,7 @@ Note: Any invalid filename characters are replaced with spaces. | Example template filename | Result | | :--- | :--- | -|`$YYYY-$MM-%DD, $hh $mm $ss - $PARENT_FOLDER_NAME by %USERNAME%` | `2024-11-22, 12 08 54 - PowerShell project by cgaarden` | +|`$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 From c866728c8db1c8a5300b5fac30bf390bf0d8227f Mon Sep 17 00:00:00 2001 From: Christian Gaarden Gaardmark Date: Tue, 25 Feb 2025 17:41:09 -0800 Subject: [PATCH 13/13] Replace Variables feature is off by default --- hub/powertoys/newplus.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hub/powertoys/newplus.md b/hub/powertoys/newplus.md index 922420722b..abea858603 100644 --- a/hub/powertoys/newplus.md +++ b/hub/powertoys/newplus.md @@ -48,7 +48,7 @@ The option enables you to toggle the display of starting digits, spaces and dots #### 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. +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 disabled. Note: Any invalid filename characters are replaced with spaces. @@ -92,7 +92,7 @@ These special variables are case-sensitive, so they will only work when used in | Variable | Explanation | | :--- | :--- | -| `$PARENT_FOLDER_NAME` | Expands to the name of the parent folder. | +| `$PARENT_FOLDER_NAME` | Expands to the name of the parent folder. This only works in template subfolders. | ##### Environment variables