mirror of
https://github.com/jazir555/GamesDows.git
synced 2025-06-06 07:37:24 +02:00
Update WIP Create C++executable
This commit is contained in:
parent
54e47431d6
commit
9051b3c2b5
@ -33,45 +33,18 @@ if not exist "%temp_dir%" (
|
|||||||
icacls "%temp_dir%" /grant Everyone:(F) >> %log_file% 2>&1
|
icacls "%temp_dir%" /grant Everyone:(F) >> %log_file% 2>&1
|
||||||
echo Temp directory permissions set. >> %log_file%
|
echo Temp directory permissions set. >> %log_file%
|
||||||
|
|
||||||
:: Step 2: Check for Visual Studio Build Tools
|
:: Step 2: Install .NET Framework 4.8 (NetFx4-AdvSrvs)
|
||||||
echo Checking for Visual Studio Build Tools... >> %log_file%
|
echo Installing .NET Framework 4.8 (NetFx4-AdvSrvs)... >> %log_file%
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" >nul 2>&1
|
echo Installing .NET Framework 4.8 (NetFx4-AdvSrvs)...
|
||||||
|
dism /online /enable-feature /featurename:NetFx4-AdvSrvs /All /NoRestart >> %log_file% 2>&1
|
||||||
|
echo DISM command exit code: %errorlevel% >> %log_file%
|
||||||
if %errorlevel% neq 0 (
|
if %errorlevel% neq 0 (
|
||||||
echo Visual Studio Build Tools not found. Installing... >> %log_file%
|
echo Failed to install .NET Framework 4.8 (NetFx4-AdvSrvs). >> %log_file%
|
||||||
powershell -command "Invoke-WebRequest -Uri https://aka.ms/vs/16/release/vs_buildtools.exe -OutFile %installer%; Start-Process -Wait -FilePath %installer% -ArgumentList '--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --passive --norestart'; Remove-Item -Force %installer%" >> %log_file% 2>&1
|
echo Failed to install .NET Framework 4.8 (NetFx4-AdvSrvs). Check the log for details: %log_file%
|
||||||
if %errorlevel% neq 0 (
|
exit /b
|
||||||
echo Failed to install Visual Studio Build Tools. >> %log_file%
|
|
||||||
echo Failed to install Visual Studio Build Tools.
|
|
||||||
pause
|
|
||||||
exit /b
|
|
||||||
)
|
|
||||||
echo Visual Studio Build Tools installed successfully. >> %log_file%
|
|
||||||
)
|
|
||||||
|
|
||||||
:: Step 3: Check for Visual Studio Build Tools
|
|
||||||
echo Checking for Visual Studio Build Tools... >> %log_file%
|
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" >nul 2>&1
|
|
||||||
if %errorlevel% neq 0 (
|
|
||||||
echo Visual Studio Build Tools not found. Downloading... >> %log_file%
|
|
||||||
powershell -command "Invoke-WebRequest -Uri https://aka.ms/vs/16/release/vs_buildtools.exe -OutFile %installer%" >> %log_file% 2>&1
|
|
||||||
if %errorlevel% neq 0 (
|
|
||||||
echo Failed to download Visual Studio Build Tools installer. >> %log_file%
|
|
||||||
echo Failed to download Visual Studio Build Tools installer.
|
|
||||||
pause
|
|
||||||
exit /b
|
|
||||||
)
|
|
||||||
echo Running Visual Studio Build Tools installer... >> %log_file%
|
|
||||||
start /wait "" "%installer%" --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --passive --norestart >> %log_file% 2>&1
|
|
||||||
if %errorlevel% neq 0 (
|
|
||||||
echo Failed to install Visual Studio Build Tools. >> %log_file%
|
|
||||||
echo Failed to install Visual Studio Build Tools.
|
|
||||||
pause
|
|
||||||
exit /b
|
|
||||||
)
|
|
||||||
echo Visual Studio Build Tools installed successfully. >> %log_file%
|
|
||||||
) else (
|
|
||||||
echo Visual Studio Build Tools are already installed. >> %log_file%
|
|
||||||
)
|
)
|
||||||
|
echo .NET Framework 4.8 (NetFx4-AdvSrvs) installed successfully. >> %log_file%
|
||||||
|
echo .NET Framework 4.8 (NetFx4-AdvSrvs) installed successfully.
|
||||||
|
|
||||||
:: Step 4: Install Windows SDK
|
:: Step 4: Install Windows SDK
|
||||||
echo Downloading Windows SDK... >> %log_file%
|
echo Downloading Windows SDK... >> %log_file%
|
||||||
@ -122,6 +95,31 @@ rmdir /s /q "%TMP_DIR%"
|
|||||||
|
|
||||||
pause
|
pause
|
||||||
|
|
||||||
|
:: Step 3: Check for Visual Studio Build Tools
|
||||||
|
echo Checking for Visual Studio Build Tools... >> %log_file%
|
||||||
|
reg query "HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" >nul 2>&1
|
||||||
|
if %errorlevel% neq 0 (
|
||||||
|
echo Visual Studio Build Tools not found. Downloading... >> %log_file%
|
||||||
|
powershell -command "Invoke-WebRequest -Uri https://aka.ms/vs/16/release/vs_buildtools.exe -OutFile %installer%" >> %log_file% 2>&1
|
||||||
|
if %errorlevel% neq 0 (
|
||||||
|
echo Failed to download Visual Studio Build Tools installer. >> %log_file%
|
||||||
|
echo Failed to download Visual Studio Build Tools installer.
|
||||||
|
pause
|
||||||
|
exit /b
|
||||||
|
)
|
||||||
|
echo Running Visual Studio Build Tools installer... >> %log_file%
|
||||||
|
start /wait "" "%installer%" --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --passive --norestart >> %log_file% 2>&1
|
||||||
|
if %errorlevel% neq 0 (
|
||||||
|
echo Failed to install Visual Studio Build Tools. >> %log_file%
|
||||||
|
echo Failed to install Visual Studio Build Tools.
|
||||||
|
pause
|
||||||
|
exit /b
|
||||||
|
)
|
||||||
|
echo Visual Studio Build Tools installed successfully. >> %log_file%
|
||||||
|
) else (
|
||||||
|
echo Visual Studio Build Tools are already installed. >> %log_file%
|
||||||
|
)
|
||||||
|
|
||||||
:: Step 5: Create the C++ source file using PowerShell
|
:: Step 5: Create the C++ source file using PowerShell
|
||||||
echo Creating C++ source file using PowerShell... >> %log_file%
|
echo Creating C++ source file using PowerShell... >> %log_file%
|
||||||
powershell -command "Add-Content -Path '%cpp_code%' -Value '#include <windows.h>'; Add-Content -Path '%cpp_code%' -Value 'int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)'; Add-Content -Path '%cpp_code%' -Value '{'; Add-Content -Path '%cpp_code%' -Value ' return 0;'; Add-Content -Path '%cpp_code%' -Value '}';"
|
powershell -command "Add-Content -Path '%cpp_code%' -Value '#include <windows.h>'; Add-Content -Path '%cpp_code%' -Value 'int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)'; Add-Content -Path '%cpp_code%' -Value '{'; Add-Content -Path '%cpp_code%' -Value ' return 0;'; Add-Content -Path '%cpp_code%' -Value '}';"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user