mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-06-18 07:47:09 +02:00
Replace the use of wmic (deprecated) with a powershell call
This commit is contained in:
parent
49488ded01
commit
74b25bdcb1
@ -4,7 +4,7 @@ echo "Opening Stable Diffusion UI - Developer Console.." & echo.
|
|||||||
|
|
||||||
cd /d %~dp0
|
cd /d %~dp0
|
||||||
|
|
||||||
set PATH=C:\Windows\System32;%PATH%
|
set PATH=C:\Windows\System32;C:\Windows\System32\WindowsPowerShell\v1.0;%PATH%
|
||||||
|
|
||||||
@rem set legacy and new installer's PATH, if they exist
|
@rem set legacy and new installer's PATH, if they exist
|
||||||
if exist "installer" set PATH=%cd%\installer;%cd%\installer\Library\bin;%cd%\installer\Scripts;%cd%\installer\Library\usr\bin;%PATH%
|
if exist "installer" set PATH=%cd%\installer;%cd%\installer\Library\bin;%cd%\installer\Scripts;%cd%\installer\Library\usr\bin;%PATH%
|
||||||
@ -26,6 +26,7 @@ call conda --version
|
|||||||
echo.
|
echo.
|
||||||
echo COMSPEC=%COMSPEC%
|
echo COMSPEC=%COMSPEC%
|
||||||
echo.
|
echo.
|
||||||
|
powershell -Command "(Get-WmiObject Win32_VideoController | Select-Object Name, AdapterRAM, DriverDate, DriverVersion)"
|
||||||
|
|
||||||
@rem activate the legacy environment (if present) and set PYTHONPATH
|
@rem activate the legacy environment (if present) and set PYTHONPATH
|
||||||
if exist "installer_files\env" (
|
if exist "installer_files\env" (
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
cd /d %~dp0
|
cd /d %~dp0
|
||||||
echo Install dir: %~dp0
|
echo Install dir: %~dp0
|
||||||
|
|
||||||
set PATH=C:\Windows\System32;C:\Windows\System32\wbem;%PATH%
|
set PATH=C:\Windows\System32;C:\Windows\System32\WindowsPowerShell\v1.0;%PATH%
|
||||||
set PYTHONHOME=
|
set PYTHONHOME=
|
||||||
|
|
||||||
if exist "on_sd_start.bat" (
|
if exist "on_sd_start.bat" (
|
||||||
@ -39,7 +39,7 @@ call where conda
|
|||||||
call conda --version
|
call conda --version
|
||||||
echo .
|
echo .
|
||||||
echo COMSPEC=%COMSPEC%
|
echo COMSPEC=%COMSPEC%
|
||||||
wmic path win32_VideoController get name,AdapterRAM,DriverDate,DriverVersion
|
powershell -Command "(Get-WmiObject Win32_VideoController | Select-Object Name, AdapterRAM, DriverDate, DriverVersion)"
|
||||||
|
|
||||||
@rem Download the rest of the installer and UI
|
@rem Download the rest of the installer and UI
|
||||||
call scripts\on_env_start.bat
|
call scripts\on_env_start.bat
|
||||||
|
@ -405,18 +405,19 @@ def has_discrete_graphics_card():
|
|||||||
if system == "Windows":
|
if system == "Windows":
|
||||||
try:
|
try:
|
||||||
env = dict(os.environ)
|
env = dict(os.environ)
|
||||||
env["PATH"] += (
|
env["PATH"] += os.pathsep + "C:/Windows/System32/WindowsPowerShell/v1.0".replace("/", os.path.sep)
|
||||||
os.pathsep
|
|
||||||
+ "C:/Windows/System32".replace("/", os.path.sep)
|
# PowerShell command to get the names of graphics cards
|
||||||
+ os.pathsep
|
command = [
|
||||||
+ "C:/Windows/System32/wbem".replace("/", os.path.sep)
|
"powershell",
|
||||||
)
|
"-Command",
|
||||||
output = subprocess.check_output(
|
"(Get-WmiObject Win32_VideoController).Name",
|
||||||
["wmic", "path", "win32_videocontroller", "get", "name"], stderr=subprocess.STDOUT, env=env
|
]
|
||||||
)
|
# Run the command and decode the output
|
||||||
|
output = subprocess.check_output(command, universal_newlines=True, stderr=subprocess.STDOUT, env=env)
|
||||||
# Filter for discrete graphics cards (NVIDIA, AMD, etc.)
|
# Filter for discrete graphics cards (NVIDIA, AMD, etc.)
|
||||||
discrete_gpus = ["NVIDIA", "AMD", "ATI"]
|
discrete_gpus = ["NVIDIA", "AMD", "ATI"]
|
||||||
return any(gpu in output.decode() for gpu in discrete_gpus)
|
return any(gpu in output for gpu in discrete_gpus)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user