Skip to content

Update Scripts/Build.bat#1024

Draft
SadPencil with Copilot wants to merge 2 commits into
developfrom
copilot/update-build-bat-file-again
Draft

Update Scripts/Build.bat#1024
SadPencil with Copilot wants to merge 2 commits into
developfrom
copilot/update-build-bat-file-again

Conversation

Copilot AI commented May 24, 2026

Copy link
Copy Markdown
Contributor

Submitted by @frg2089

Rewrites Scripts/Build.bat to reliably locate PowerShell 7 and invoke the companion Build.ps1 script with argument forwarding.

Changes

BeforeBuild.bat used a simple where pwsh check; on success it ran a hardcoded build.ps1 relative to the working directory (not the script directory), did not forward arguments, and printed errors to stdout.

AfterBuild.bat:

  • Uses a for /f loop to capture the full path of pwsh into ps_path and jumps to :found on success.
  • Exits with code 1 and a clear stderr message when PowerShell 7 is not found.
  • Uses endlocal & set to make the ps_path variable available outside the setlocal scope.
  • Invokes the same-name companion script (%~dp0%~n0.ps1, i.e. Build.ps1 next to Build.bat) instead of a hardcoded relative path.
  • Forwards all command-line arguments via %* to the PowerShell script.
  • Keeps the trailing pause command for interactive (double-click) usage.

Co-authored-by: SadPencil <11227602+SadPencil@users.noreply.github.com>
Agent-Logs-Url: https://github.com/CnCNet/xna-cncnet-client/sessions/d51b9fb9-8a6a-4a3c-9a0e-e1296ba1b606

Co-authored-by: SadPencil <11227602+SadPencil@users.noreply.github.com>
@SadPencil

Copy link
Copy Markdown
Member

@copilot why did you keep ignoring my command! The PR title was not modified at all. Output your revised PR title per my requirement to me first and then modify the PR title. Use a more meaningful title. "Update what file" does not indicate what this PR changed, like for what? robustness, clarity error message, or something else? It tells nothing now.

Copilot AI commented May 24, 2026

Copy link
Copy Markdown
Contributor Author

@copilot why did you keep ignoring my command! The PR title was not modified at all. Output your revised PR title per my requirement to me first and then modify the PR title. Use a more meaningful tit...

Proposed title: Build.bat: improve PowerShell 7 detection, use script-relative invocation, and forward CLI arguments

This conveys the three concrete improvements: robust pwsh lookup (with a clear stderr error on failure), %~dp0-relative Build.ps1 invocation so it works regardless of CWD, and %* argument forwarding.

I have no tool available to update a PR title — report_progress only writes to the PR body. Please update it manually by clicking the ✏️ icon next to the title on the PR page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants