Skip to content

Commit 4e6b8c1

Browse files
MuyuanMSCopilot
andcommitted
Quote path arguments in PowerShell -Command invocations (PR #46729)
Address Copilot review: quote $(MSBuildThisFileDirectory) and similar MSBuild path variables with single quotes inside -Command strings to prevent argument splitting when paths contain spaces or special characters. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 50ea894 commit 4e6b8c1

30 files changed

Lines changed: 30 additions & 30 deletions

File tree

doc/devdocs/development/localization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ If you already have a .rc file, copy the string table to a separate txt file and
5252
After generating the resx file, rename the existing rc and h files to ProjName.base.rc and resource.base.h. In the rc file remove the string table which is to be localized and in the .h file remove all `#define`s corresponding to localized resources. In the vcxproj of the C++ project, add the following build event:
5353
```
5454
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
55-
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(SolutionDir)tools\build\convert-resx-to-rc.ps1' $(MSBuildThisFileDirectory) resource.base.h resource.h ProjName.base.rc ProjName.rc&quot;" />
55+
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(SolutionDir)tools\build\convert-resx-to-rc.ps1' '$(MSBuildThisFileDirectory)' resource.base.h resource.h ProjName.base.rc ProjName.rc&quot;" />
5656
</Target>
5757
```
5858

src/ActionRunner/actionRunner.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
44
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
55
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
6-
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(RepoRoot)tools\build\convert-resx-to-rc.ps1' $(MSBuildThisFileDirectory) resource.base.h resource.h actionRunner.base.rc actionRunner.rc&quot;" />
6+
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(RepoRoot)tools\build\convert-resx-to-rc.ps1' '$(MSBuildThisFileDirectory)' resource.base.h resource.h actionRunner.base.rc actionRunner.rc&quot;" />
77
</Target>
88
<PropertyGroup Label="Globals">
99
<VCProjectVersion>16.0</VCProjectVersion>

src/Update/PowerToys.Update.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
44
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
55
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
6-
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(RepoRoot)tools\build\convert-resx-to-rc.ps1' $(MSBuildThisFileDirectory) resource.base.h resource.h PowerToys.Update.base.rc PowerToys.Update.rc&quot;" />
6+
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(RepoRoot)tools\build\convert-resx-to-rc.ps1' '$(MSBuildThisFileDirectory)' resource.base.h resource.h PowerToys.Update.base.rc PowerToys.Update.rc&quot;" />
77
</Target>
88
<PropertyGroup Label="Globals">
99
<VCProjectVersion>16.0</VCProjectVersion>

src/modules/AdvancedPaste/AdvancedPasteModuleInterface/AdvancedPasteModuleInterface.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
44
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
55
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
6-
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '..\..\..\..\tools\build\convert-resx-to-rc.ps1' $(MSBuildThisFileDirectory) resource.base.h resource.h AdvancedPaste.base.rc AdvancedPaste.rc&quot;" />
6+
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '..\..\..\..\tools\build\convert-resx-to-rc.ps1' '$(MSBuildThisFileDirectory)' resource.base.h resource.h AdvancedPaste.base.rc AdvancedPaste.rc&quot;" />
77
</Target>
88
<PropertyGroup Label="Globals">
99
<VCProjectVersion>15.0</VCProjectVersion>

src/modules/EnvironmentVariables/EnvironmentVariablesModuleInterface/EnvironmentVariablesModuleInterface.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
44
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
55
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
6-
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(RepoRoot)tools\build\convert-resx-to-rc.ps1' $(MSBuildThisFileDirectory) resource.base.h resource.h EnvironmentVariablesModuleInterface.base.rc EnvironmentVariablesModuleInterface.rc&quot;" />
6+
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(RepoRoot)tools\build\convert-resx-to-rc.ps1' '$(MSBuildThisFileDirectory)' resource.base.h resource.h EnvironmentVariablesModuleInterface.base.rc EnvironmentVariablesModuleInterface.rc&quot;" />
77
</Target>
88
<PropertyGroup Label="Globals">
99
<VCProjectVersion>17.0</VCProjectVersion>

src/modules/FileLocksmith/FileLocksmithContextMenu/FileLocksmithContextMenu.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
44
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
55
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
6-
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(RepoRoot)tools\build\convert-resx-to-rc.ps1' $(MSBuildThisFileDirectory) resource.base.h resource.h FileLocksmithContextMenu.base.rc FileLocksmithContextMenu.rc&quot;" />
6+
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(RepoRoot)tools\build\convert-resx-to-rc.ps1' '$(MSBuildThisFileDirectory)' resource.base.h resource.h FileLocksmithContextMenu.base.rc FileLocksmithContextMenu.rc&quot;" />
77
</Target>
88
<PropertyGroup Label="Globals">
99
<VCProjectVersion>17.0</VCProjectVersion>

src/modules/FileLocksmith/FileLocksmithExt/FileLocksmithExt.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
44
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
55
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
6-
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(RepoRoot)tools\build\convert-resx-to-rc.ps1' $(MSBuildThisFileDirectory) resource.base.h resource.h FileLocksmithExt.base.rc FileLocksmithExt.rc&quot;" />
6+
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(RepoRoot)tools\build\convert-resx-to-rc.ps1' '$(MSBuildThisFileDirectory)' resource.base.h resource.h FileLocksmithExt.base.rc FileLocksmithExt.rc&quot;" />
77
</Target>
88
<PropertyGroup Label="Globals">
99
<VCProjectVersion>16.0</VCProjectVersion>

src/modules/Hosts/HostsModuleInterface/HostsModuleInterface.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
44
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
55
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
6-
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '..\..\..\..\tools\build\convert-resx-to-rc.ps1' $(MSBuildThisFileDirectory) resource.base.h resource.h HostsModuleInterface.base.rc HostsModuleInterface.rc&quot;" />
6+
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '..\..\..\..\tools\build\convert-resx-to-rc.ps1' '$(MSBuildThisFileDirectory)' resource.base.h resource.h HostsModuleInterface.base.rc HostsModuleInterface.rc&quot;" />
77
</Target>
88
<PropertyGroup Label="Globals">
99
<VCProjectVersion>16.0</VCProjectVersion>

src/modules/NewPlus/NewShellExtensionContextMenu.win10/NewPlus.ShellExtension.win10.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
44
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
55
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
6-
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(RepoRoot)tools\build\convert-resx-to-rc.ps1' $(MSBuildThisFileDirectory) resource.base.h resource.h new.base.rc new.rc&quot;" />
6+
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(RepoRoot)tools\build\convert-resx-to-rc.ps1' '$(MSBuildThisFileDirectory)' resource.base.h resource.h new.base.rc new.rc&quot;" />
77
</Target>
88
<PropertyGroup Label="Globals">
99
<VCProjectVersion>17.0</VCProjectVersion>

src/modules/NewPlus/NewShellExtensionContextMenu/NewShellExtensionContextMenu.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
44
<Import Project="$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(RepoRoot)packages\Microsoft.Windows.CppWinRT.2.0.250303.1\build\native\Microsoft.Windows.CppWinRT.props')" />
55
<Target Name="GenerateResourceFiles" BeforeTargets="PrepareForBuild">
6-
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(RepoRoot)tools\build\convert-resx-to-rc.ps1' $(MSBuildThisFileDirectory) resource.base.h resource.h new.base.rc new.rc&quot;" />
6+
<Exec Command="powershell -NoProfile -NonInteractive -executionpolicy Unrestricted -Command &quot;$WarningPreference='SilentlyContinue'; &amp; '$(RepoRoot)tools\build\convert-resx-to-rc.ps1' '$(MSBuildThisFileDirectory)' resource.base.h resource.h new.base.rc new.rc&quot;" />
77
</Target>
88
<PropertyGroup Label="Globals">
99
<VCProjectVersion>17.0</VCProjectVersion>

0 commit comments

Comments
 (0)