Skip to content

Instantly share code, notes, and snippets.

@oneleo
Last active January 5, 2021 02:03
Show Gist options
  • Select an option

  • Save oneleo/760ec5794890c2dfd795417fb5007af6 to your computer and use it in GitHub Desktop.

Select an option

Save oneleo/760ec5794890c2dfd795417fb5007af6 to your computer and use it in GitHub Desktop.
One-click to Install File Server with disk for Windows
:: Run as administrator through CMD.exe
@echo off
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
netsh advfirewall firewall add rule name="Port 5222" dir=in action=allow protocol=TCP localport=5222 > NUL
netsh advfirewall firewall add rule name="Port 443" dir=in action=allow protocol=TCP localport=443 > NUL
choco install -y googlechrome chrome-remote-desktop-host google-drive-file-stream dontsleep.install > NUL
::"%ProgramFiles%\Google\Chrome\Application\chrome.exe" --new-window --incognito --app="https://remotedesktop.google.com/access"
"%ProgramFiles%\Google\Chrome\Application\chrome.exe" "https://remotedesktop.google.com/access"
"%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe" "https://remotedesktop.google.com/access"
::pause
:: Run as administrator through CMD.exe
@echo off
:: Install Chocolatey
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco install -y git.install --params "/NoShellIntegration" > NUL
choco install -y dontsleep.install golang > NUL
:: Set firewall
netsh advfirewall firewall add rule name="Port 80" dir=in action=allow protocol=TCP localport=80 > NUL
netsh advfirewall firewall add rule name="Port 81" dir=in action=allow protocol=TCP localport=81 > NUL
netsh advfirewall firewall add rule name="Port 82" dir=in action=allow protocol=TCP localport=82 > NUL
:: Install file server
md "%USERPROFILE%\go\src\github.com\oneleo"
cd /d "%USERPROFILE%\go\src\github.com\oneleo"
"%ProgramFiles%\Git\cmd\git.exe" clone "https://github.com/oneleo/fsgo.git"
cd /d "%USERPROFILE%\go\src\github.com\oneleo\fsgo"
"%SystemDrive%\Go\bin\go.exe" install
:: Install invisible tool
cd /d "%USERPROFILE%\go\src\github.com\oneleo"
"%ProgramFiles%\Git\cmd\git.exe" clone "https://github.com/oneleo/silentfs.git"
copy /y "%USERPROFILE%\go\src\github.com\oneleo\silentfs\invisible.vbs" "%USERPROFILE%\go\bin\" > NUL
:: Predict Drive Letter
"%windir%\System32\wscript.exe" "%USERPROFILE%\go\bin\invisible.vbs" "%USERPROFILE%\go\bin\fsgo" -p 80 -f "D:\\"
"%windir%\System32\wscript.exe" "%USERPROFILE%\go\bin\invisible.vbs" "%USERPROFILE%\go\bin\fsgo" -p 81 -f "C:\\"
"%windir%\System32\wscript.exe" "%USERPROFILE%\go\bin\invisible.vbs" "%USERPROFILE%\go\bin\fsgo" -p 82 -f "E:\\"
:: Remove directory and file
rmdir /Q /S "%USERPROFILE%\go\src\github.com\oneleo" > nul 2>&1
rmdir /Q /S "%USERPROFILE%\Downloads\760ec5794890c2dfd795417fb5007af6-86baacbfe4ac34c0f781e32ca8ffd0bf5bd95d1f" > nul 2>&1
del /F /Q "%USERPROFILE%\Downloads\760ec5794890c2dfd795417fb5007af6-86baacbfe4ac34c0f781e32ca8ffd0bf5bd95d1f.zip" > nul 2>&1
::pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment