| Spides 2003-04-27, 6:41 pm |
| Below is a batch file, anyone have any ideas how I can stop it detecting an Operating System. This update will only run on 2000 Pro, it will not run on XP, well the company wont support XP but we want it on a Server with XP......
@Echo off
REM if no parameter are specified
REM ftp_client.bat is downloaded from local CLICK gateway
REM and then it is executed
REM if parameters (files) are specified then they are downloaded
REM from local CLICK gateway and NO file is executed.
::@setlocal
@if (%MZ_DEBUG%)==(1) goto debug_on
@goto debug_off
:debug_on
@Echo off
@goto begin_main
:debug_off
@Echo off
@goto begin_main
REM This batch file determines local FTP server from either local_gw.ini file
REM or CLICK's TS.INI file.
REM if niether are present then user is prompted to type server name into notepad
REM and the file is saved as local_gw.ini
REM ------------------------------------------------------
:begin_main
REM ------------------------------------------------------
setlocal
set GET_FILES=
set NO_PARAM=
set NEW_INSTALL=
REM ------------------------------------------------------
REM copy itself into C:\ASX_UPGRADE if not run from there
if /I "%~p0"=="\ASX_UPGRADE\" goto skip_self_update
echo "%~p0"
Echo Updating self....
if not exist c:\asx_upgrade md c:\asx_upgrade
copy upd_clnt.bat c:\asx_upgrade\upd_clnt.bat
copy %~dpnx0 c:\asx_upgrade /V >nul
c:
cd\asx_upgrade
Echo Executing "upd_clnt.bat %1 %2 %3 %4 %5 %6 %7 %8 %9"
upd_clnt.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
::ENDS HERE
:skip_self_update
REM ------------------------------------------------------
:get_gw
REM ------------------------------------------------------
REM get it from local_gw.ini file
Echo Trying local_gw.ini....
if exist local_gw.ini for /F "skip=1" %%a in ('type local_gw.ini') do call :LG_fn3 %%a
REM get it from TS.INI file
if [%LOCAL_GW%]==[] call :GetLocalGateway
REM if found
if not [%LOCAL_GW%]==[] echo Local gateway and FTP server is : %LOCAL_GW%
if not [%LOCAL_GW%]==[] echo Local gateway and FTP server is : >local_gw.ini
if not [%LOCAL_GW%]==[] echo %LOCAL_GW% >>local_gw.ini
REM if none found prompt user
if [%LOCAL_GW%]==[] goto no_local_gw
if [%NEW_INSTALL%]==[1] copy local_gw.ini c:\asx_upgrade
REM ------------------------------------------------------
REM If no parameters were supplied download only ftp_client.bat
REM ------------------------------------------------------
if [%1]==[] set NO_PARAM=1
if [%1]==[] set GET_FILES=ftp_client.bat
if [%1]==[] goto end_of_parse_loop
REM ------------------------------------------------------
arse_loop
REM ------------------------------------------------------
if [%1]==[] goto end_of_parse_loop
set GET_FILES=%GET_FILES% %1
shift
goto parse_loop
:end_of_parse_loop
REM ------------------------------------------------------
Echo Constructing FTP script.....
REM ------------------------------------------------------
echo user anonymous click@user >ftp_src.txt
echo bin >>ftp_src.txt
REM echo mget %GET_FILES% >>ftp_src.txt
call :get_files %GET_FILES%
echo bye >>ftp_src.txt
echo FTP session to %LOCAL_GW% FTP starting......
ftp -i -n -s:ftp_src.txt %LOCAL_GW% >ftp_out.txt
echo FTP session finished.
for /F "tokens=1* delims=+" %%a in ('echo %GET_FILES%') do call :check_size %%a
REM ------------------------------------------------------
if [%NO_PARAM%]==[1] if not exist ftp_client.bat goto :NO_FTP_CLIENT
if not [%NO_PARAM%]==[1] goto :END_FILE
Echo.
Echo Executing script...
Echo.
endlocal
ftp_client.bat
:END_FILE
endlocal
goto :EOF
REM ------------------------------------------------------
REM ------------------------------------------------------
REM ------------------------------------------------------
REM ------------------------------------------------------
REM ------------------------------------------------------
REM - FUNCTIONS ------------------------------------------
REM ------------------------------------------------------
REM ------------------------------------------------------
:get_files
REM ------------------------------------------------------
if [%1]==[] goto :EOF
echo get %1 >>ftp_src.txt
shift
goto get_files
REM ------------------------------------------------------
:GetLocalGateway
REM ------------------------------------------------------
Echo Trying ts.ini....
if exist c:\click for /F %%a in ('dir /b/s c:\click\ts.ini') do call :FindGateway %%a
if exist d:\click for /F %%a in ('dir /b/s c:\click\ts.ini') do call :FindGateway %%a
if exist e:\click for /F %%a in ('dir /b/s c:\click\ts.ini') do call :FindGateway %%a
goto :EOF
REM ------------------------------------------------------
:FindGateway
REM ------------------------------------------------------
for /F "skip=2 tokens=1,2 delims==" %%d in ('find /I "Gateway=" %1') do call :LG_fn3 %%e
goto :EOF
REM ------------------------------------------------------
:LG_fn3
REM ------------------------------------------------------
if not [%LOCAL_GW%]==[] goto :EOF
if [%1]==[] goto :EOF
@if (%MZ_DEBUG%)==(2) Echo LG_fn3:%1
Echo Checking for FTP on %1 ...please wait....
ing %1 > nul
echo user anonymous click@user >test_ftp.scr
echo bye >>test_ftp.scr
ftp -i -n -s:test_ftp.scr %1 >ftp_test_out.txt
find "FTP" ftp_test_out.txt > nul
:Echo %errorlevel%
if not [%errorlevel%]==[0] goto no_ftp
set LOCAL_GW=%1
goto :EOF
:no_ftp
Echo Host %1 is either not online or not a FTP server.
goto :EOF
REM ------------------------------------------------------
:no_local_gw
REM ------------------------------------------------------
Echo Require user input...
Echo Enter name or IP address of local gateway on the line below, then save the file and exit. >local_gw.ini
Echo.>>local_gw.ini
notepad local_gw.ini
for /F "skip=1" %%a in ('type local_gw.ini') do call :LG_fn3 %%a
if not [%LOCAL_GW%]==[] goto get_gw
Echo Gateway not found!
if exist local_gw.ini del /F /Q local_gw.ini
Echo.
endlocal
goto :EOF
REM ------------------------------------------------------
:NO_FTP_CLIENT
REM ------------------------------------------------------
Echo.
Echo You tried to download and execute "ftp_client.bat"
Echo The file "ftp_client.bat" was not found on the %LOCAL_GW%.
Echo Please contact Click support.
Echo.
pause
endlocal
goto :EOF
REM ------------------------------------------------------
:check_size
REM ------------------------------------------------------
:loop_cs
if [%1]==[] goto loop_cs_end
:echo dir /-c %1
if exist %1 for /f "skip=5 tokens=1,2,3,4" %%a in ('dir /-c %1') do call :delete_zero_size %LOCAL_DIR%%%d %%c
if not exist %1 Echo "%1" not downloaded
shift /1
goto loop_cs
:loop_cs_end
goto :EOF
REM ------------------------------------------------------
:delete_zero_size
REM ------------------------------------------------------
if not exist %1 goto :EOF
if [%2]==[free] goto :EOF
if [%2]==[0] del %1
if not [%2]==[0] echo %1 - %2 bytes
goto :EOF |