Sosyal açıldı! Bir göz at → Hemen gir →

? Elektrik Gidince otomatik vm açma

adana4343

KY Kıdemli Üye
KAYIT
28 Şub 2024
Mesajlar
270
Tepki puanı
3
selamlar
chatgpt ile 1 tane bat dosyası yazdırdım elektrik gidip gelince otomatik olarak sanalları açıyor belli bir aralıkla kağıt üstünde sorunsuz çalışıyor her şey ama
7 tane aktif kullandığım pc var 2 pcde bilgisayarlar ölüyor elimle açtığımda 0 sorun iken bat ile açtığımda ortalama 12-18 saat sonrası o sekmedeki 24 vm
1 cpu 1.5 gb ram ile gta6 açmaya çalışıyormuş gibi bir kasmaya bürünüyor maradon'a 10 dakikada felan geçiyor 990 pro ssd var %99disk kullanıyor felan filan :D
edit: ingame kasma kasılma yok yükleme ekranları patates oluyor

kodtaki hatayı bulabilecek yada daha mantıklı bir yol gösterebilecek varsa memnun olurum :)

başarı oranı kısmi olarak yüksek sizde deneyip kullanabilirsiniz sorumluluk tamamen size ait :)
kod'u bat olarak kaydedip set "ROOT=E:\AUTO" e:auto olan kısma sizin sanalarınız kurulu olduğu dosya yolunu gösterin kendi vmxleri bulacaktır.

Kod:
Kod:
@echo off
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

:: ===== Start + Show Consoles + Safe-Resume Fix (WS 15.5.7) =====
:: - Deletes stale suspend/lock files (*.vmss, *.lck) to avoid "Resuming..." state after power loss
:: - Starts VMs and opens their GUI windows
:: - Adds 15s delay between VMs

set "ROOT=E:\AUTO"
set "DELAY=5"
set "LOG=%TEMP%\vm_boot_show_gui_RESUME_FIX.log"

set "VMRUN32=C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe"
set "VMRUN64=C:\Program Files\VMware\VMware Workstation\vmrun.exe"
set "VMWARE32=C:\Program Files (x86)\VMware\VMware Workstation\vmware.exe"
set "VMWARE64=C:\Program Files\VMware\VMware Workstation\vmware.exe"
set "VMPLAYER32=C:\Program Files (x86)\VMware\VMware Workstation\vmplayer.exe"
set "VMPLAYER64=C:\Program Files\VMware\VMware Workstation\vmplayer.exe"

set "VMRUN="
if exist "%VMRUN64%" set "VMRUN=%VMRUN64%"
if exist "%VMRUN32%" set "VMRUN=%VMRUN32%"

set "VMGUI="
if exist "%VMWARE64%" set "VMGUI=%VMWARE64%"
if exist "%VMWARE32%" set "VMGUI=%VMWARE32%"
if "%VMGUI%"=="" (
  if exist "%VMPLAYER64%" set "VMGUI=%VMPLAYER64%"
  if exist "%VMPLAYER32%" set "VMGUI=%VMPLAYER32%"
)

echo ==== %DATE% %TIME% : start_and_show_vms_RESUME_FIX ==== > "%LOG%"
echo ROOT=%ROOT% >> "%LOG%"
echo DELAY=%DELAY% >> "%LOG%"
echo VMRUN="%VMRUN%" >> "%LOG%"
echo VMGUI="%VMGUI%" >> "%LOG%"

if "%VMRUN%"=="" (
  echo [ERROR] vmrun.exe not found. See log: "%LOG%"
  >> "%LOG%" echo [ERROR] vmrun.exe not found.
  type "%LOG%"
  exit /b 1
)

if "%VMGUI%"=="" (
  echo [ERROR] vmware.exe/vmplayer.exe not found. See log: "%LOG%"
  >> "%LOG%" echo [ERROR] No GUI binary found.
  type "%LOG%"
  exit /b 1
)

if not exist "%ROOT%" (
  echo [ERROR] ROOT not found: "%ROOT%"
  >> "%LOG%" echo [ERROR] ROOT not found.
  type "%LOG%"
  exit /b 2
)

:: Ensure Authorization Service is running (required by Workstation on Windows)
set "AUTH_SERVICE=VMware Authorization Service"
sc query "%AUTH_SERVICE%" | find /I "RUNNING" >nul
if errorlevel 1 (
  echo [INFO] Starting "%AUTH_SERVICE%" ...
  >> "%LOG%" echo [INFO] Starting "%AUTH_SERVICE%"
  net start "%AUTH_SERVICE%" >> "%LOG%" 2>&1
)

:: Build list of VMX files
set "LIST=%TEMP%\vmx_boot_list_RESUME.txt"
dir /s /b /a:-d "%ROOT%\*.vmx" > "%LIST%" 2>nul

set "COUNT=0"
for /f "usebackq delims=" %%F in ("%LIST%") do (
  set /a COUNT+=1
  set "VMX=%%~fF"
  set "VMDIR=%%~dpF"

  echo.
  echo === Cleaning & Starting: %%~nxF ===
  echo DIR: "!VMDIR!"

  rem 1) Remove stale suspend and lock files to avoid "Resuming..." state
  if exist "!VMDIR!*.vmss" (
    echo   - Removing suspend state: "!VMDIR!*.vmss"
    del /f /q "!VMDIR!*.vmss" >> "%LOG%" 2>&1
  )
  for /d %%L in ("!VMDIR!*.lck") do (
    echo   - Removing lock dir: "%%~fL"
    rd /s /q "%%~fL" >> "%LOG%" 2>&1
  )

  rem 2) Start VM (Workstation target, headful so console can open)
  echo   - Starting via vmrun...
  "%VMRUN%" -T ws start "!VMX!" >> "%LOG%" 2>&1
  if errorlevel 1 (
    echo     -> start failed, will still open console
  ) else (
    echo     -> started
  )

  rem 3) Open console window
  start "" "%VMGUI%" "!VMX!"

  if not "%DELAY%"=="" timeout /t %DELAY% /nobreak >nul
)

echo.
echo Done. Attempted: %COUNT% VM(s). Log: "%LOG%"
type "%LOG%"
exit /b 0
 
Anasayfa Kayıt ol Giriş yap
Üst Alt