this is version2,
read the header-comments at the beginning of the batch-file to see whats changed since version1
its not a huge difference but its enough of a difference to be worth posting,
mainly because of the new custom ftp server splash-screen/welcome-message function
MakeFTPserver.cmd
read the header-comments at the beginning of the batch-file to see whats changed since version1
its not a huge difference but its enough of a difference to be worth posting,
mainly because of the new custom ftp server splash-screen/welcome-message function
MakeFTPserver.cmd
Code
@goto :batch
=================================================================================================================================
this is verssion2, only changes made are:
1)added function of choosing a custom splash-screen/welcome-message for the FTP-server instead of using IIS's default
2)more acurate wording of what the "turn-off" function in the main-menu does by labling it as "disable" not "remove"
3)an internal code-efficentcy change of calling macro "setupserver_header" to display some of the text you see at each
step of setting up the ftp-server instead of re-typing the same "echo" commands over and over at each step that displays them
=================================================================================================================================
:batch
@echo off
title %~n0
echo.>"%homedrive%\AdminPriv.test"
if exist "%homedrive%\AdminPriv.test" goto :has_uac_elev
cls
echo.requesting UAC elevation ...
echo.set x = createobject("shell.application")>"%temp%\uacelev.vbs"
echo.x.shellexecute "%comspec%","/D /C "^&chr("34")^&"@%~dpnx0"^&chr("34"),"%homedrive%\","runas",1 >>"%temp%\uacelev.vbs"
echo.x.shellexecute "%comspec%","/D /C @del /f /q "^&chr("34")^&wscript.scriptfullname^&chr("34"),"%homedrive%\","open",0 >>"%temp%\uacelev.vbs"
start "" "%temp%\uacelev.vbs"
exit
:has_uac_elev
del /f /q "%homedrive%\AdminPriv.test" >nul
mode con: cols=90 lines=20
:mainmenu
cls
echo.--
echo.hosting an FTP-server on this computer:
echo.--
echo.
echo.
echo.tap "s" to set-up or edit FTP-server
echo.tap "d" to disable FTPserver
choice /c sd >nul
cls
if %errorlevel% EQU 1 call :setupserver
if %errorlevel% EQU 2 call :removeserver
goto :mainmenu
:setupserver
set "showsetupheader=call :setupserver_header"
%showsetupheader%
echo.select a port to host FTP server on:
echo.leave blank to use standard FTP-port (port 21)
set/p "port=[PORT]:"
if "%port%"=="" set "port=21"
%showsetupheader%
echo.select a folder to use as the FTPserver's file directory
echo.if the folder you choose does not exist it will be created
echo.leave blank to use default location "%homedrive%\FTPserverFiles"
set/p "ftprootdirectory=[folder]:"
if "%ftprootdirectory%"=="" set "ftprootdirectory=%homedrive%\FTPserverFiles"
if NOT exist "%ftprootdirectory%" mkdir "%ftprootdirectory%"
%showsetupheader%
echo.set-up the server's Welcome-Message/Spash-Screen:
echo.leave blank to use the default WelcomeMessage "Welcome! Please log-in."
set/p "welcomemsg=[WelcomeMessage]:"
if "%welcomemsg%"=="" set "welcomemsg=Welcome! Please log-in."
%showsetupheader%
echo.windows users will be the username and passwords used to log into the FTP-server
echo.all of them have full access to read/write/modify files on the FTP-server
echo.
echo.tap ^<space^> to create the FTP-server
pause >nul
cls
echo.setting up FTP-server, this may take a few minutes ...
DISM /Online /Enable-Feature /FeatureName:IIS-WebServerRole >nul
DISM /Online /Enable-Feature /FeatureName:IIS-FTPServer >nul
DISM /Online /Enable-Feature /FeatureName:IIS-FTPSvc >nul
DISM /Online /Enable-Feature /FeatureName:IIS-FTPExtensibility >nul
"%windir%\system32\inetsrv\appcmd.exe" DELETE SITE hostedFTPserver >nul
"%windir%\system32\inetsrv\appcmd.exe" ADD SITE /name:hostedFTPserver /bindings:ftp://*:%port% /PhysicalPath:"%ftprootdirectory%" >nul
icacls "%ftprootdirectory%" /Grant "Network Service":F /T >nul
"%windir%\system32\inetsrv\appcmd.exe" set config -section:system.applicationHost/sites /[name='hostedFTPserver'].ftpServer.security.ssl.controlChannelPolicy:"SslAllow" >nul
"%windir%\system32\inetsrv\appcmd.exe" set config -section:system.applicationHost/sites /[name='hostedFTPserver'].ftpServer.security.ssl.dataChannelPolicy:"SslAllow" >nul
"%windir%\system32\inetsrv\appcmd.exe" set config -section:system.applicationHost/sites /[name='hostedFTPserver'].ftpServer.security.authentication.basicAuthentication.enabled:true >nul
"%windir%\system32\inetsrv\appcmd.exe" set config -section:system.applicationHost/sites /[name='hostedFTPserver'].ftpServer.messages.bannerMessage:"%welcomemsg%" /commit:apphost
"%windir%\system32\inetsrv\appcmd.exe" set config -section:system.applicationHost/sites /[name='hostedFTPserver'].ftpServer.messages.suppressDefaultBanner:"True" /commit:apphost
"%windir%\system32\inetsrv\appcmd.exe" set config hostedFTPserver /section:system.ftpserver/security/authorization /+[accessType='Allow',permissions='Read,Write',roles='',users='*'] /commit:apphost >nul
netsh int portproxy add v4tov4 listenport=80 connectaddress=127.0.0.1 connectport=21
cls
echo.--
echo.FTP-server created on port: [ %port% ]
echo.FTP-server's file directory is [ %ftprootdirectory% ]
echo.--
echo.
echo.--
echo.use your windows users' username ^& passwords to log into the FTP-server
echo.they will all have read/write/modify permissions
echo.--
echo.
echo.
echo.tap ^<space^> to continue
pause >nul
goto :end
:setupserver_header
cls
echo.--
echo.setting FTP-server settings
echo.--
echo.
echo.
goto :end
:removeserver
echo.disableing FTP-server ...
"%windir%\system32\inetsrv\appcmd.exe" DELETE SITE hostedFTPserver >nul
call netsh int portproxy delete v4tov4 listenport=80 >nul
echo.
echo.
echo.FTP-server is now disabled.
echo.tap ^<space^> to continue
pause >nul
:end

Bitcoin: