MCPcopy Create free account
hub / github.com/xpf0000/FlyEnv / buildSetAutoStartScript

Function buildSetAutoStartScript

src/shared/WindowsHelperFallback.ts:668–691  ·  view source on GitHub ↗
(args: ValidatedSetAutoStartArgs, tempFilePath?: string)

Source from the content-addressed store, hash-verified

666}
667
668function buildSetAutoStartScript(args: ValidatedSetAutoStartArgs, tempFilePath?: string): string {
669 const runtimeSetup = tempFilePath
670 ? `$payload = Get-Content -LiteralPath ${powerShellString(tempFilePath)} -Raw | ConvertFrom-Json
671$enabled = [bool]$payload.enabled
672$taskName = [string]$payload.taskName
673$exePath = [string]$payload.exePath`
674 : `$enabled = ${args.enabled ? '$true' : '$false'}
675$taskName = ${powerShellString(args.taskName)}
676$exePath = ${powerShellString(args.exePath)}`
677 return `${buildPowerShellPreamble()}
678${runtimeSetup}
679if ($enabled) {
680 & schtasks.exe /create /tn $taskName /tr ('"' + $exePath + '"') /sc onlogon /rl highest /f | Out-Null
681 if ($LASTEXITCODE -ne 0) {
682 throw "schtasks.exe /create failed with exit code $LASTEXITCODE"
683 }
684}
685else {
686 & schtasks.exe /delete /tn $taskName /f | Out-Null
687 if ($LASTEXITCODE -ne 0) {
688 throw "schtasks.exe /delete failed with exit code $LASTEXITCODE"
689 }
690}`
691}
692
693function buildSslAddTrustedCertScript(args: ValidatedSslAddTrustedCertArgs): string {
694 return `${buildPowerShellPreamble()}

Callers 1

Calls 2

powerShellStringFunction · 0.85
buildPowerShellPreambleFunction · 0.85

Tested by

no test coverage detected