mirror of
https://github.com/massgravel/get.activated.win.git
synced 2024-12-28 21:18:57 +01:00
Avoid temp variable
This commit is contained in:
parent
37c885bd76
commit
40d372b1b5
1 changed files with 2 additions and 2 deletions
4
get
4
get
|
@ -49,7 +49,7 @@ foreach ($path in $paths) {
|
||||||
|
|
||||||
$rand = [Guid]::NewGuid().Guid
|
$rand = [Guid]::NewGuid().Guid
|
||||||
$isAdmin = [bool]([Security.Principal.WindowsIdentity]::GetCurrent().Groups -match 'S-1-5-32-544')
|
$isAdmin = [bool]([Security.Principal.WindowsIdentity]::GetCurrent().Groups -match 'S-1-5-32-544')
|
||||||
$FilePath = if ($isAdmin) { "$env:SystemRoot\Temp\MAS_$rand.cmd" } else { "$env:TEMP\MAS_$rand.cmd" }
|
$FilePath = if ($isAdmin) { "$env:SystemRoot\Temp\MAS_$rand.cmd" } else { "$env:USERPROFILE\AppData\Local\Temp\MAS_$rand.cmd" }
|
||||||
|
|
||||||
$ScriptArgs = "$args "
|
$ScriptArgs = "$args "
|
||||||
$prefix = "@::: $rand `r`n"
|
$prefix = "@::: $rand `r`n"
|
||||||
|
@ -60,5 +60,5 @@ Set-Content -Path $FilePath -Value $content
|
||||||
$env:ComSpec = "$env:SystemRoot\system32\cmd.exe"
|
$env:ComSpec = "$env:SystemRoot\system32\cmd.exe"
|
||||||
Start-Process cmd.exe "/c """"$FilePath"" $ScriptArgs""" -Wait
|
Start-Process cmd.exe "/c """"$FilePath"" $ScriptArgs""" -Wait
|
||||||
|
|
||||||
$FilePaths = @("$env:TEMP\MAS*.cmd", "$env:SystemRoot\Temp\MAS*.cmd")
|
$FilePaths = @("$env:SystemRoot\Temp\MAS*.cmd", "$env:USERPROFILE\AppData\Local\Temp\MAS*.cmd")
|
||||||
foreach ($FilePath in $FilePaths) { Get-Item $FilePath | Remove-Item }
|
foreach ($FilePath in $FilePaths) { Get-Item $FilePath | Remove-Item }
|
||||||
|
|
Loading…
Reference in a new issue