51 lines
2.7 KiB
Batchfile
51 lines
2.7 KiB
Batchfile
pushd "%~dp0"
|
|
@echo off
|
|
goto :Start
|
|
|
|
---------------------------------------
|
|
Добавляет CreoLauncher и создает на него ярлыки.
|
|
|
|
Позиционные параметры:
|
|
[1] qn - неинтерактивный запуск (игнорируются паузы)
|
|
[2] <> - версия продуктов PTC
|
|
|
|
Для работы необходимы права администратора.
|
|
---------------------------------------
|
|
|
|
:Start
|
|
set PTCVER=7.0.2.0
|
|
if "%~2" NEQ "" (set PTCVER=%~2)
|
|
if not exist "C:\Program Files\PTC\Creo %PTCVER%\Parametric\bin\parametric.exe" (
|
|
goto :Exit
|
|
)
|
|
|
|
:Check_Admin
|
|
net session >nul 2>&1
|
|
if %errorLevel% == 0 (
|
|
goto :Copy_Launcher
|
|
) else (
|
|
echo Restart as administrator!
|
|
set code=5
|
|
goto :Exit
|
|
)
|
|
|
|
:Copy_Launcher
|
|
mkdir "C:\Program Files\PTC\Creo %PTCVER%\Parametric\launcher"
|
|
echo F|xcopy ".\CreoLauncher.ps1" "C:\Program Files\PTC\Creo %PTCVER%\Parametric\launcher\CreoLauncher.ps1" /I /H /Y /C /R /S
|
|
echo F|xcopy ".\CreoLauncher.txt" "C:\Program Files\PTC\Creo %PTCVER%\Parametric\launcher\CreoLauncher.txt" /I /H /Y /C /R /S
|
|
|
|
:Create_Links
|
|
powershell -nologo -noprofile -command "& {$WshShell = New-Object -comObject WScript.Shell; $Shortcut = $WshShell.CreateShortcut('%PUBLIC%\Desktop\Creo Launcher.lnk'); $Shortcut.TargetPath = '%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe'; $Shortcut.Arguments = '-ExecutionPolicy Bypass -File ""C:\Program Files\PTC\Creo %PTCVER%\Parametric\launcher\CreoLauncher.ps1""'; $Shortcut.WorkingDirectory = 'C:\Program Files\PTC\Creo %PTCVER%\Parametric\launcher'; $Shortcut.IconLocation = 'C:\Program Files\PTC\Creo %PTCVER%\Parametric\install\nt\creologo.ico'; $Shortcut.Save();}"
|
|
powershell -nologo -noprofile -command "& {$WshShell = New-Object -comObject WScript.Shell; $Shortcut = $WshShell.CreateShortcut('%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\PTC\Creo Launcher.lnk'); $Shortcut.TargetPath = '%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe'; $Shortcut.Arguments = '-ExecutionPolicy Bypass -File ""C:\Program Files\PTC\Creo %PTCVER%\Parametric\launcher\CreoLauncher.ps1""'; $Shortcut.WorkingDirectory = 'C:\Program Files\PTC\Creo %PTCVER%\Parametric\launcher'; $Shortcut.IconLocation = 'C:\Program Files\PTC\Creo %PTCVER%\Parametric\install\nt\creologo.ico'; $Shortcut.Save();}"
|
|
|
|
:Backup_PSF
|
|
echo F|xcopy "C:\Program Files\PTC\Creo %PTCVER%\Parametric\bin\parametric.psf" "C:\Program Files\PTC\Creo %PTCVER%\Parametric\launcher\parametric.psf.bak" /I /H /Y /C /R /S
|
|
|
|
:Cacls_PSF
|
|
icacls "C:\Program Files\PTC\Creo %PTCVER%\Parametric\bin\parametric.psf" /Q /C /T /grant *S-1-5-32-545:F
|
|
|
|
:Exit
|
|
if "%~1" NEQ "qn" pause
|
|
popd
|
|
exit %code%
|