Microwin appinstall - #5
Closed
Real-MullaC wants to merge 12 commits into
Closed
Conversation
Added quotes to the file paths. Put all the arguments in 1 string (as that also works fine)
CodingWonders
requested changes
Aug 1, 2025
Co-authored-by: CodingWonders <101426328+CodingWonders@users.noreply.github.com>
Comment on lines
+91
to
+143
| # Log configuration file check | ||
| "Checking for configuration file at: $env:HOMEDRIVE\winutil-config.json" | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber | ||
|
|
||
| if (Test-Path -Path "$env:HOMEDRIVE\winutil-config.json") | ||
| { | ||
| "Configuration file detected. Applying auto-configuration..." | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber | ||
| Write-Host "Configuration file detected. Applying..." | ||
|
|
||
| try { | ||
| "Downloading WinUtil script from christitus.com..." | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber | ||
| Invoke-RestMethod -Uri "https://christitus.com/win" -OutFile "$env:HOMEDRIVE\winutil.ps1" | ||
| "WinUtil script downloaded successfully" | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber | ||
|
|
||
| # Properly escaped command with ampersand quoted | ||
| $cmd = '$env:HOMEDRIVE\winutil.ps1 -Config ''$env:HOMEDRIVE\winutil-config.json'' -Run' | ||
| "Prepared command: $cmd" | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber | ||
|
|
||
| # Start WinUtil and wait for completion | ||
| "Starting WinUtil process and waiting for completion..." | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber | ||
| $process = Start-Process powershell.exe -Verb RunAs -ArgumentList @( | ||
| "-NoProfile", | ||
| "-ExecutionPolicy", "Bypass", | ||
| "-Command", $cmd | ||
| ) -PassThru -WindowStyle Hidden | ||
|
|
||
| "WinUtil process started (PID: $($process.Id)). Waiting for completion..." | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber | ||
|
|
||
| # Wait for the process to complete | ||
| $process.WaitForExit() | ||
| "WinUtil process completed with exit code: $($process.ExitCode)" | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber | ||
|
|
||
| # Give a small delay to ensure all operations are complete | ||
| Start-Sleep -Seconds 3 | ||
|
|
||
| "Cleaning up temporary files..." | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber | ||
| if (Test-Path "$env:HOMEDRIVE\winutil.ps1") { | ||
| Remove-Item -Path "$env:HOMEDRIVE\winutil.ps1" -Force | ||
| "Removed winutil.ps1" | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber | ||
| } | ||
| if (Test-Path "$env:HOMEDRIVE\winutil-config.json") { | ||
| Remove-Item -Path "$env:HOMEDRIVE\winutil-config.json" -Force | ||
| "Removed winutil-config.json" | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber | ||
| } | ||
| "Cleanup completed" | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber | ||
| } | ||
| catch { | ||
| "Error during WinUtil auto-configuration: $($_.Exception.Message)" | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber | ||
| Write-Host "Error during WinUtil auto-configuration: $($_.Exception.Message)" | ||
| } | ||
| } | ||
| else { | ||
| "No configuration file found. Skipping auto-configuration." | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber | ||
| } |
Owner
There was a problem hiding this comment.
Did you really vibe-code this s...?
Owner
|
This will be merged by me |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
Testing
Impact
Issue related to PR
Additional Information
Checklist