-
-
Notifications
You must be signed in to change notification settings - Fork 707
Expand file tree
/
Copy pathEnable File Sharing.cmd
More file actions
35 lines (30 loc) · 1.03 KB
/
Enable File Sharing.cmd
File metadata and controls
35 lines (30 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
@echo off
set "settingName=FileSharing"
set "stateValue=1"
set "scriptPath=%~f0"
set "script=%windir%\AtlasModules\Scripts\ScriptWrappers\EnableFileSharing.ps1"
if not exist "%script%" (
echo Script not found.
echo "%script%"
pause
exit /b 1
)
set "___args="%~f0" %*"
fltmc > nul 2>&1 || (
echo Administrator privileges are required.
powershell -c "Start-Process -Verb RunAs -FilePath 'cmd' -ArgumentList """/c $env:___args"""" 2> nul || (
echo You must run this script as admin.
if "%*"=="" pause
exit /b 1
)
exit /b
)
reg add "HKLM\SOFTWARE\AtlasOS\Services\%settingName%" /v state /t REG_DWORD /d %stateValue% /f > nul
reg add "HKLM\SOFTWARE\AtlasOS\Services\%settingName%" /v path /t REG_SZ /d "%scriptPath%" /f > nul
powershell -EP RemoteSigned -NoP -File "%script%"
if "%~1"=="/silent" exit /b
choice /c:yn /n /m "Finished, would you like to restart now to apply the changes? [Y/N] "
if %ERRORLEVEL% == 1 shutdown /r /t 0
echo Finished, File Sharing is now enabled.
pause > nul
exit /b