mirror of
				https://github.com/massgravel/Microsoft-Activation-Scripts.git
				synced 2025-11-04 09:03:25 +08:00 
			
		
		
		
	Fix crash issue when scripts are running under a path with special characters
This commit is contained in:
		
							parent
							
								
									372eb73a02
								
							
						
					
					
						commit
						172fd7b1c5
					
				@ -154,7 +154,6 @@ goto dk_done
 | 
			
		||||
 | 
			
		||||
set "_work=%~dp0"
 | 
			
		||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
 | 
			
		||||
set "_workp=%_work:'=''%"
 | 
			
		||||
 | 
			
		||||
set "_batf=%~f0"
 | 
			
		||||
set "_batp=%_batf:'=''%"
 | 
			
		||||
@ -197,7 +196,7 @@ goto dk_done
 | 
			
		||||
 | 
			
		||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
 | 
			
		||||
 | 
			
		||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
 | 
			
		||||
if /i not "%tstresult%"=="FullLanguage" (
 | 
			
		||||
%eline%
 | 
			
		||||
@ -9733,9 +9732,9 @@ namespace LibTSforge.PhysicalStore
 | 
			
		||||
}
 | 
			
		||||
'@
 | 
			
		||||
$ErrorActionPreference = 'Stop'
 | 
			
		||||
$binPath = Join-Path -Path $env:_workp -ChildPath "BIN\LibTSforge.dll"
 | 
			
		||||
$binPath = "$env:_work\BIN\LibTSforge.dll"
 | 
			
		||||
 | 
			
		||||
if (Test-Path -Path $binPath) {
 | 
			
		||||
if (Test-Path -LiteralPath $binPath) {
 | 
			
		||||
    Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..."
 | 
			
		||||
    Add-Type -Path $binPath
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -235,7 +235,7 @@ goto dk_done
 | 
			
		||||
 | 
			
		||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
 | 
			
		||||
 | 
			
		||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
 | 
			
		||||
if /i not "%tstresult%"=="FullLanguage" (
 | 
			
		||||
%eline%
 | 
			
		||||
 | 
			
		||||
@ -238,7 +238,7 @@ goto dk_done
 | 
			
		||||
 | 
			
		||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
 | 
			
		||||
 | 
			
		||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
 | 
			
		||||
if /i not "%tstresult%"=="FullLanguage" (
 | 
			
		||||
%eline%
 | 
			
		||||
 | 
			
		||||
@ -228,7 +228,7 @@ goto dk_done
 | 
			
		||||
 | 
			
		||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
 | 
			
		||||
 | 
			
		||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
 | 
			
		||||
if /i not "%tstresult%"=="FullLanguage" (
 | 
			
		||||
%eline%
 | 
			
		||||
 | 
			
		||||
@ -257,7 +257,7 @@ goto dk_done
 | 
			
		||||
 | 
			
		||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
 | 
			
		||||
 | 
			
		||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
 | 
			
		||||
if /i not "%tstresult%"=="FullLanguage" (
 | 
			
		||||
%eline%
 | 
			
		||||
 | 
			
		||||
@ -221,7 +221,6 @@ goto dk_done
 | 
			
		||||
 | 
			
		||||
set "_work=%~dp0"
 | 
			
		||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
 | 
			
		||||
set "_workp=%_work:'=''%"
 | 
			
		||||
 | 
			
		||||
set "_batf=%~f0"
 | 
			
		||||
set "_batp=%_batf:'=''%"
 | 
			
		||||
@ -264,7 +263,7 @@ goto dk_done
 | 
			
		||||
 | 
			
		||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
 | 
			
		||||
 | 
			
		||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
 | 
			
		||||
if /i not "%tstresult%"=="FullLanguage" (
 | 
			
		||||
%eline%
 | 
			
		||||
@ -7616,9 +7615,9 @@ namespace LibTSforge.PhysicalStore
 | 
			
		||||
}
 | 
			
		||||
'@
 | 
			
		||||
$ErrorActionPreference = 'Stop'
 | 
			
		||||
$binPath = Join-Path -Path $env:_workp -ChildPath "BIN\LibTSforge.dll"
 | 
			
		||||
$binPath = "$env:_work\BIN\LibTSforge.dll"
 | 
			
		||||
 | 
			
		||||
if (Test-Path -Path $binPath) {
 | 
			
		||||
if (Test-Path -LiteralPath $binPath) {
 | 
			
		||||
    Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..."
 | 
			
		||||
    Add-Type -Path $binPath
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -188,7 +188,7 @@ goto dk_done
 | 
			
		||||
 | 
			
		||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
 | 
			
		||||
 | 
			
		||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
 | 
			
		||||
if /i not "%tstresult%"=="FullLanguage" (
 | 
			
		||||
%eline%
 | 
			
		||||
 | 
			
		||||
@ -193,7 +193,7 @@ goto dk_done
 | 
			
		||||
 | 
			
		||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
 | 
			
		||||
 | 
			
		||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
 | 
			
		||||
if /i not "%tstresult%"=="FullLanguage" (
 | 
			
		||||
%eline%
 | 
			
		||||
 | 
			
		||||
@ -187,7 +187,7 @@ goto done2
 | 
			
		||||
 | 
			
		||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
 | 
			
		||||
 | 
			
		||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
 | 
			
		||||
if /i not "%tstresult%"=="FullLanguage" (
 | 
			
		||||
%eline%
 | 
			
		||||
 | 
			
		||||
@ -188,7 +188,7 @@ goto dk_done
 | 
			
		||||
 | 
			
		||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
 | 
			
		||||
 | 
			
		||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
for /f "delims=" %%a in ('%psc% "if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}" %nul6%') do (set tstresult=%%a)
 | 
			
		||||
 | 
			
		||||
if /i not "%tstresult%"=="FullLanguage" (
 | 
			
		||||
%eline%
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user