Issue #19962: The Windows build process now creates "python.bat"
in the root of the source tree, which passes all arguments through
to the most recently built interpreter.
diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj
index bd12624..5387343 100644
--- a/PCbuild/python.vcxproj
+++ b/PCbuild/python.vcxproj
@@ -156,6 +156,14 @@
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+    <CustomBuildAfterTargets Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Link</CustomBuildAfterTargets>
+    <CustomBuildAfterTargets Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Link</CustomBuildAfterTargets>
+    <CustomBuildAfterTargets Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'">Link</CustomBuildAfterTargets>
+    <CustomBuildAfterTargets Condition="'$(Configuration)|$(Platform)'=='PGInstrument|x64'">Link</CustomBuildAfterTargets>
+    <CustomBuildAfterTargets Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'">Link</CustomBuildAfterTargets>
+    <CustomBuildAfterTargets Condition="'$(Configuration)|$(Platform)'=='PGUpdate|x64'">Link</CustomBuildAfterTargets>
+    <CustomBuildAfterTargets Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Link</CustomBuildAfterTargets>
+    <CustomBuildAfterTargets Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Link</CustomBuildAfterTargets>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
@@ -176,6 +184,25 @@
       <StackReserveSize>2000000</StackReserveSize>
       <BaseAddress>0x1d000000</BaseAddress>
     </Link>
+    <CustomBuildStep>
+      <Command>echo @rem This script invokes the most recently built Python with all arguments&gt; "$(SolutionDir)..\python.bat"
+echo @rem passed through to the interpreter.  This file is generated by the&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem build process and any changes *will* be thrown away by the next&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem rebuild.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem This is only meant as a convenience for developing CPython&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem and using it outside of that context is ill-advised.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @echo Running $(Configuration)^^^|$(Platform) interpreter...&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @"$(OutDir)python$(PyDebugExt).exe" %%*&gt;&gt; "$(SolutionDir)..\python.bat"</Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Message>Creating convenience batch file for easily invoking the newly built interpreter.</Message>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Outputs>$(SolutionDir)..\python.bat</Outputs>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Inputs>$(OutDir)python$(PyDebugExt).exe;%(Inputs)</Inputs>
+    </CustomBuildStep>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <Midl>
@@ -199,6 +226,25 @@
       <StackReserveSize>2000000</StackReserveSize>
       <BaseAddress>0x1d000000</BaseAddress>
     </Link>
+    <CustomBuildStep>
+      <Command>echo @rem This script invokes the most recently built Python with all arguments&gt; "$(SolutionDir)..\python.bat"
+echo @rem passed through to the interpreter.  This file is generated by the&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem build process and any changes *will* be thrown away by the next&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem rebuild.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem This is only meant as a convenience for developing CPython&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem and using it outside of that context is ill-advised.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @echo Running $(Configuration)^^^|$(Platform) interpreter...&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @"$(OutDir)python$(PyDebugExt).exe" %%*&gt;&gt; "$(SolutionDir)..\python.bat"</Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Message>Creating convenience batch file for easily invoking the newly built interpreter.</Message>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Outputs>$(SolutionDir)..\python.bat</Outputs>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Inputs>$(OutDir)python$(PyDebugExt).exe;%(Inputs)</Inputs>
+    </CustomBuildStep>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
@@ -221,6 +267,25 @@
       <StackReserveSize>2000000</StackReserveSize>
       <BaseAddress>0x1d000000</BaseAddress>
     </Link>
+    <CustomBuildStep>
+      <Command>echo @rem This script invokes the most recently built Python with all arguments&gt; "$(SolutionDir)..\python.bat"
+echo @rem passed through to the interpreter.  This file is generated by the&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem build process and any changes *will* be thrown away by the next&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem rebuild.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem This is only meant as a convenience for developing CPython&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem and using it outside of that context is ill-advised.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @echo Running $(Configuration)^^^|$(Platform) interpreter...&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @"$(OutDir)python$(PyDebugExt).exe" %%*&gt;&gt; "$(SolutionDir)..\python.bat"</Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Message>Creating convenience batch file for easily invoking the newly built interpreter.</Message>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Outputs>$(SolutionDir)..\python.bat</Outputs>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Inputs>$(OutDir)python$(PyDebugExt).exe;%(Inputs)</Inputs>
+    </CustomBuildStep>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <Midl>
@@ -246,6 +311,25 @@
       <StackReserveSize>4194304</StackReserveSize>
       <BaseAddress>0x1d000000</BaseAddress>
     </Link>
+    <CustomBuildStep>
+      <Command>echo @rem This script invokes the most recently built Python with all arguments&gt; "$(SolutionDir)..\python.bat"
+echo @rem passed through to the interpreter.  This file is generated by the&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem build process and any changes *will* be thrown away by the next&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem rebuild.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem This is only meant as a convenience for developing CPython&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem and using it outside of that context is ill-advised.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @echo Running $(Configuration)^^^|$(Platform) interpreter...&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @"$(OutDir)python$(PyDebugExt).exe" %%*&gt;&gt; "$(SolutionDir)..\python.bat"</Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Message>Creating convenience batch file for easily invoking the newly built interpreter.</Message>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Outputs>$(SolutionDir)..\python.bat</Outputs>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Inputs>$(OutDir)python$(PyDebugExt).exe;%(Inputs)</Inputs>
+    </CustomBuildStep>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'">
     <ClCompile>
@@ -268,6 +352,25 @@
       <ImportLibrary>
       </ImportLibrary>
     </Link>
+    <CustomBuildStep>
+      <Command>echo @rem This script invokes the most recently built Python with all arguments&gt; "$(SolutionDir)..\python.bat"
+echo @rem passed through to the interpreter.  This file is generated by the&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem build process and any changes *will* be thrown away by the next&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem rebuild.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem This is only meant as a convenience for developing CPython&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem and using it outside of that context is ill-advised.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @echo Running $(Configuration)^^^|$(Platform) interpreter...&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @"$(OutDir)python$(PyDebugExt).exe" %%*&gt;&gt; "$(SolutionDir)..\python.bat"</Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Message>Creating convenience batch file for easily invoking the newly built interpreter.</Message>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Outputs>$(SolutionDir)..\python.bat</Outputs>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Inputs>$(OutDir)python$(PyDebugExt).exe;%(Inputs)</Inputs>
+    </CustomBuildStep>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='PGInstrument|x64'">
     <Midl>
@@ -294,6 +397,25 @@
       </ImportLibrary>
       <TargetMachine>MachineX64</TargetMachine>
     </Link>
+    <CustomBuildStep>
+      <Command>echo @rem This script invokes the most recently built Python with all arguments&gt; "$(SolutionDir)..\python.bat"
+echo @rem passed through to the interpreter.  This file is generated by the&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem build process and any changes *will* be thrown away by the next&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem rebuild.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem This is only meant as a convenience for developing CPython&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem and using it outside of that context is ill-advised.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @echo Running $(Configuration)^^^|$(Platform) interpreter...&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @"$(OutDir)python$(PyDebugExt).exe" %%*&gt;&gt; "$(SolutionDir)..\python.bat"</Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Message>Creating convenience batch file for easily invoking the newly built interpreter.</Message>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Outputs>$(SolutionDir)..\python.bat</Outputs>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Inputs>$(OutDir)python$(PyDebugExt).exe;%(Inputs)</Inputs>
+    </CustomBuildStep>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'">
     <ClCompile>
@@ -316,6 +438,25 @@
       <ImportLibrary>
       </ImportLibrary>
     </Link>
+    <CustomBuildStep>
+      <Command>echo @rem This script invokes the most recently built Python with all arguments&gt; "$(SolutionDir)..\python.bat"
+echo @rem passed through to the interpreter.  This file is generated by the&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem build process and any changes *will* be thrown away by the next&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem rebuild.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem This is only meant as a convenience for developing CPython&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem and using it outside of that context is ill-advised.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @echo Running $(Configuration)^^^|$(Platform) interpreter...&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @"$(OutDir)python$(PyDebugExt).exe" %%*&gt;&gt; "$(SolutionDir)..\python.bat"</Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Message>Creating convenience batch file for easily invoking the newly built interpreter.</Message>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Outputs>$(SolutionDir)..\python.bat</Outputs>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Inputs>$(OutDir)python$(PyDebugExt).exe;%(Inputs)</Inputs>
+    </CustomBuildStep>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='PGUpdate|x64'">
     <Midl>
@@ -342,6 +483,25 @@
       </ImportLibrary>
       <TargetMachine>MachineX64</TargetMachine>
     </Link>
+    <CustomBuildStep>
+      <Command>echo @rem This script invokes the most recently built Python with all arguments&gt; "$(SolutionDir)..\python.bat"
+echo @rem passed through to the interpreter.  This file is generated by the&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem build process and any changes *will* be thrown away by the next&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem rebuild.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem This is only meant as a convenience for developing CPython&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @rem and using it outside of that context is ill-advised.&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @echo Running $(Configuration)^^^|$(Platform) interpreter...&gt;&gt; "$(SolutionDir)..\python.bat"
+echo @"$(OutDir)python$(PyDebugExt).exe" %%*&gt;&gt; "$(SolutionDir)..\python.bat"</Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Message>Creating convenience batch file for easily invoking the newly built interpreter.</Message>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Outputs>$(SolutionDir)..\python.bat</Outputs>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Inputs>$(OutDir)python$(PyDebugExt).exe;%(Inputs)</Inputs>
+    </CustomBuildStep>
   </ItemDefinitionGroup>
   <ItemGroup>
     <None Include="..\PC\pycon.ico" />
@@ -361,4 +521,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>
\ No newline at end of file