powershell migration
This commit is contained in:
@@ -8,4 +8,5 @@ if '%errorlevel%' NEQ '0' (
|
||||
)
|
||||
|
||||
call "%~dp0apps-manager.bat" connect
|
||||
|
||||
endlocal
|
||||
@@ -2,21 +2,21 @@
|
||||
:: ==========================================
|
||||
:: Проверка прав администратора
|
||||
:: ==========================================
|
||||
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
|
||||
if '%errorlevel%' NEQ '0' (
|
||||
echo Требуются права администратора. Перезапуск...
|
||||
powershell -Command "Start-Process -FilePath '%~f0' -ArgumentList '%*' -Verb RunAs"
|
||||
exit /b
|
||||
)
|
||||
@REM >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
|
||||
@REM if '%errorlevel%' NEQ '0' (
|
||||
@REM echo Требуются права администратора. Перезапуск...
|
||||
@REM powershell -Command "Start-Process -FilePath '%~f0' -ArgumentList '%*' -Verb RunAs "
|
||||
@REM exit /b
|
||||
@REM )
|
||||
|
||||
:: ==========================================
|
||||
:: Инициализация
|
||||
:: ==========================================
|
||||
setlocal EnableDelayedExpansion
|
||||
set "init=%~dp0\..\settings\init.bat"
|
||||
set "init=%~dp0\settings\init.bat"
|
||||
call "%init%"
|
||||
|
||||
set "config=%csv%"
|
||||
set "config=%apps-all%"
|
||||
|
||||
:: ==========================================
|
||||
:: Аргумент действия
|
||||
@@ -33,20 +33,20 @@ for /f "skip=1 tokens=1-8 delims=," %%A in (%config%) do (
|
||||
set "To=%%C"
|
||||
set "Type=%%D"
|
||||
set "Enabled=%%E"
|
||||
set "ExtraVariables=%%F"
|
||||
set "ExtraConnect=%%G"
|
||||
set "ExtraDisconnect=%%H"
|
||||
set "ExtraVariables=%%~F"
|
||||
set "ExtraConnect=%%~G"
|
||||
set "ExtraDisconnect=%%~H"
|
||||
|
||||
if "!Enabled!"=="1" (
|
||||
:: Разворачиваем стандартные переменные окружения
|
||||
call set "From=!From!"
|
||||
call set "To=!To!"
|
||||
if not "!ExtraConnect!"=="" call set "ExtraConnect=!ExtraConnect!"
|
||||
if not "!ExtraDisconnect!"=="" call set "ExtraDisconnect=!ExtraDisconnect!"
|
||||
call set "ExtraConnect=!ExtraConnect!"
|
||||
call set "ExtraDisconnect=!ExtraDisconnect!"
|
||||
|
||||
:: Выполняем Extra-Variables как команду
|
||||
if not "!ExtraVariables!"=="" (
|
||||
call !ExtraVariables!
|
||||
echo !ExtraVariables!
|
||||
)
|
||||
|
||||
echo ==============================
|
||||
@@ -84,7 +84,7 @@ exit /b
|
||||
:: ==========================================
|
||||
:disconnect
|
||||
echo Removing "!To!"...
|
||||
rd /S /Q "!To!" 2>nul
|
||||
rd /Q "!To!" 2>nul
|
||||
if not "!ExtraDisconnect!"=="" call !ExtraDisconnect!
|
||||
goto :eof
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
:: BatchGotAdmin BEGIN https://sites.google.com/site/eneerge/home/BatchGotAdmin | https://ss64.com/nt/rem.html | https://ss64.com/nt/cacls.html
|
||||
:: Check for permissions
|
||||
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
|
||||
|
||||
:: If error flag set, we do not have admin.
|
||||
if '%errorlevel%' NEQ '0' (
|
||||
echo Requesting administrative privileges...
|
||||
goto UACPrompt
|
||||
) else ( goto gotAdmin )
|
||||
|
||||
:UACPrompt
|
||||
echo Set UAC = CreateObject^("Shell.Application"^) > "%~dp0getadmin.vbs"
|
||||
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%~dp0getadmin.vbs"
|
||||
|
||||
"%~dp0getadmin.vbs"
|
||||
exit /B
|
||||
|
||||
:gotAdmin
|
||||
if exist "%~dp0getadmin.vbs" ( del "%~dp0getadmin.vbs" )
|
||||
pushd "%CD%"
|
||||
CD /D "%~dp0"
|
||||
:: BatchGotAdmin END
|
||||
|
||||
call "%~dp0apps-manager.bat" reconnect
|
||||
@@ -1,5 +0,0 @@
|
||||
App,From,To,Type,Enabled,Extra-Variables,Extra-Connect,Extra-Disconnect
|
||||
AIMP,%storage%\%app%,%appdata%\%app%,default,0,,,
|
||||
KeePassXC,%storage%\%app%,%appdata%\%app%,default,0,,,
|
||||
gramps,%storage%\%app%,%appdata%\%app%,default,0,,,
|
||||
EqualizerAPO,%storage%\%app%,%ProgramFiles%\%app%,isolate,1,"set ""from_1=%storage%\%app%"" && set ""to_1=%ProgramFiles%\%app%"" && set ""FabFilter_Pro-Q_3=%ProgramFiles%\VSTPlugins\FabFilter\FabFilter Pro-Q 3.dll""","reg add ""HKEY_LOCAL_MACHINE\SOFTWARE\EqualizerAPO"" /v ""ConfigPath"" /t REG_SZ /d ""%storage%\%app%"" /f && mklink ""%to_1%\VSTPlugins\FabFilter Pro-Q 3.dll"" ""%FabFilter_Pro-Q_3%""","for /f ""delims="" %%i in ('dir /aL /b %to_1%\config') do del ""%%i"" && del /q ""%to_1%\config\*"" && del /q ""%to_1%\VSTPlugins\FabFilter Pro-Q 3.dll"""
|
||||
|
@@ -0,0 +1,5 @@
|
||||
App,From,To,Type,Enabled,Extra-Variables,Extra-Connect,Extra-Disconnect
|
||||
AIMP,%storage%\%app%,%appdata%\%app%,default,0,,,
|
||||
KeePassXC,%storage%\%app%,%appdata%\%app%,default,0,,,
|
||||
gramps,%storage%\%app%,%appdata%\%app%,default,0,,,
|
||||
EqualizerAPO,%storage%\%app%,%ProgramFiles%\%app%,isolate,1,,,
|
||||
|
@@ -1,12 +0,0 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set "app=EqualizerAPO"
|
||||
|
||||
set "from_1=%storage%\%App%" && set "to_1=%ProgramFiles%\%App%" && set "FabFilter Pro-Q 3=%ProgramFiles%\VSTPlugins\FabFilter\FabFilter Pro-Q 3.dll"
|
||||
|
||||
for /f "delims=" %%i in ('dir /aL /b %To%\config') do del "%%i" && del /q "%To%\config\*" && del /q "%To%\VSTPlugins\FabFilter Pro-Q 3.dll"
|
||||
|
||||
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\EqualizerAPO" /v "ConfigPath" /t REG_SZ /d "%storage%\%App%" /f && mklink "%To%\VSTPlugins\FabFilter Pro-Q 3.dll" "%FabFilter Pro-Q 3%"
|
||||
|
||||
endlocal
|
||||
@@ -0,0 +1,16 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set "app=EqualizerAPO"
|
||||
set "from_1=%storage%\%app%"
|
||||
set "to_1=%ProgramFiles%\%app%"
|
||||
set "FabFilter Pro-Q 3=%ProgramFiles%\VSTPlugins\FabFilter\FabFilter Pro-Q 3.dll"
|
||||
|
||||
for /f "delims=" %%i in ('dir /aL /b %to_1%\config') do del "%%i"
|
||||
del /q "%to_1%\config\*"
|
||||
del /q "%to_1%\VSTPlugins\FabFilter Pro-Q 3.dll"
|
||||
|
||||
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\EqualizerAPO" /v "ConfigPath" /t REG_SZ /d "%storage%\%app%" /f
|
||||
mklink "%to_1%\VSTPlugins\FabFilter Pro-Q 3.dll" "%FabFilter Pro-Q 3%"
|
||||
|
||||
endlocal
|
||||
@@ -1,15 +0,0 @@
|
||||
setlocal
|
||||
|
||||
set "init=%~dp0\..\settings\init.bat"
|
||||
call %init%
|
||||
|
||||
for %%f in ("%apps-all%\*.bat") do (
|
||||
echo Running %%f - disconnect
|
||||
call "%%f" disconnect
|
||||
)
|
||||
for %%f in ("%apps-user%\*.bat") do (
|
||||
echo Running %%f - disconnect
|
||||
call "%%f" disconnect
|
||||
)
|
||||
|
||||
endlocal
|
||||
@@ -3,11 +3,7 @@ setlocal
|
||||
set "init=%~dp0\..\settings\init.bat"
|
||||
call %init%
|
||||
|
||||
for %%f in ("%legacy%\*.bat") do (
|
||||
echo Running %%f - reconnect
|
||||
call "%%f"
|
||||
)
|
||||
for %%f in ("%legacy%\*.bat") do (
|
||||
for %%f in ("%apps-legacy%\*.bat") do (
|
||||
echo Running %%f - reconnect
|
||||
call "%%f"
|
||||
)
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set "init=%~dp0\..\settings\init.bat"
|
||||
call %init%
|
||||
|
||||
for %%f in ("test\*.bat") do (
|
||||
echo Running %%f
|
||||
call "%%f"
|
||||
)
|
||||
|
||||
endlocal
|
||||
@@ -0,0 +1,2 @@
|
||||
$initFile = Join-Path $PSScriptRoot ".\settings\init.ps1"
|
||||
. $initFile
|
||||
@@ -0,0 +1,14 @@
|
||||
# --- init.ps1 ---
|
||||
# Переходим в папку скрипта
|
||||
Set-Location -Path $PSScriptRoot
|
||||
|
||||
# Определяем root аналогично %~dp0..\
|
||||
$root = Join-Path $PSScriptRoot ".."
|
||||
|
||||
# Подключаем vars.ps1
|
||||
$varsFile = Join-Path $root "settings\vars.ps1"
|
||||
if (Test-Path $varsFile) {
|
||||
. $varsFile # точка + пробел = source / импорт
|
||||
} else {
|
||||
Write-Warning "Vars file not found: $varsFile"
|
||||
}
|
||||
+2
-3
@@ -1,7 +1,7 @@
|
||||
:: LOCAL ::
|
||||
|
||||
:: Package Managers
|
||||
set "winget=%~dp0winget.ps1"
|
||||
set "winget=%root%\winget.ps1"
|
||||
|
||||
:: Local Root
|
||||
set "data=%root%\data"
|
||||
@@ -15,8 +15,7 @@ set "packages-user-lists-other=%packages-user-lists%\other.bat"
|
||||
|
||||
:: Apps
|
||||
set "apps=%data%\apps"
|
||||
set "csv=%data%\apps.csv"
|
||||
set "apps-all=%apps%\[all]"
|
||||
set "apps-all=%apps%\all.csv"
|
||||
set "apps-legacy=%apps%\legacy"
|
||||
set "apps-user=%apps%\%computername%"
|
||||
:: Mounts
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
Key,Value,Type
|
||||
winget,%root%\winget.ps1,Package Manager
|
||||
data,%root%\data,Local Root
|
||||
packages,%data%\packages,Packages
|
||||
apps,%data%\apps,Apps
|
||||
apps-all,%apps%\all.csv,Apps
|
||||
apps-legacy,%apps%\legacy,Apps
|
||||
mounts,%data%\mounts,Mounts
|
||||
disk-label,S:,Global
|
||||
user-name,oqyude,Global
|
||||
games,%disk-label%\Games,Main Folder
|
||||
storage,%userprofile%\Storage,Main Folder
|
||||
storage-games,N:\Games\.storage,Main Folder
|
||||
|
@@ -0,0 +1,32 @@
|
||||
# LOCAL
|
||||
|
||||
# Package Managers
|
||||
$winget = "$PSScriptRoot\winget.ps1"
|
||||
|
||||
# Local Root
|
||||
$data = "$root\data"
|
||||
|
||||
# Packages
|
||||
$packages = "$data\packages"
|
||||
$packagesInstaller = "$packages\install.bat"
|
||||
$packagesAllLists = "$packages\[all]"
|
||||
$packagesUserLists = "$packages\$env:COMPUTERNAME"
|
||||
$packagesUserListsOther = "$packagesUserLists\other.bat"
|
||||
|
||||
# Apps
|
||||
$apps = "$data\apps"
|
||||
$appsAll = "$apps\all.csv"
|
||||
$appsLegacy = "$apps\legacy"
|
||||
$appsUser = "$apps\$env:COMPUTERNAME"
|
||||
|
||||
# Mounts
|
||||
$mounts = "$data\mounts"
|
||||
|
||||
# GLOBAL
|
||||
$diskLabel = "S:"
|
||||
$userName = "oqyude"
|
||||
|
||||
# Main Folder
|
||||
$games = "$diskLabel\Games"
|
||||
$storage = "$env:USERPROFILE\Storage"
|
||||
$storageGames = "N:\Games\.storage"
|
||||
Reference in New Issue
Block a user