Jump to content

NaJeEb303

Members
  • Posts

    57
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by NaJeEb303

  1. just run the file as is. if the three lines are in the host file they will be removed, and if they are not, they will be added. how to add the more peculiar total uninstall part of your request i'm sure you can figure out yourself.

     

    @echo offset "string=www.facebook.com"set "host=C:\Windows\System32\drivers\etc\hosts"for /f "delims=" %%h in ('type "%host%" ^| find /c /i "%string%"') do (	set "result=%%h" >nul	)if "%result%"=="0" (	>>%host% echo 127.0.0.1 www.facebook.com	>>%host% echo 127.0.0.1 http://www.facebook.com/	>>%host% echo 127.0.0.1 https://www.facebook.com/	set "msg=%string% successfully added to host file	)if "%result%" geq "1" (	for /f "tokens=*" %%a in ('findstr /in ".*" "%host%"') do (		echo %%a>>"%tmp%\l_1.x"		)	for /f "eol=# tokens=1,2 delims=:" %%a in ('findstr /i ".*%string%.*" "%tmp%\l_1.x"') do (		set stringlines=%%a		)	setlocal enabledelayedexpansion	set /a "beforelines=stringlines-3"	set /a "afterlines=stringlines+1"	for /f "eol=# tokens=2* delims=:" %%a in ('findstr /in ".*" "%tmp%\l_1.x"') do (		if %%a leq !beforelines! echo %%b>>"%tmp%\l_2.x"		if %%a geq !afterlines! echo %%b>>"%tmp%\l_2.x"		)	endlocal	move /y "%tmp%\l_2.x" %host% >nul	del /q /f %tmp%\*.x	set "msg=%string% successfully removed from host file	)call ipconfig /flushdns >nulecho.echo %msg%timeout 2 /nobreak >nul | exit

    limitations:

    the script does not handle empty newlines (carriage returns). they would be typed as the ECHO status in the new host file. all lines you want it to remove must be in sequence or all lines between the first and last occurrence of the SET "string" value will be removed.

    i'm sure there is others limitations, just be careful if you edit the script. test it on some random text file or so..

     

    thank u so much for the new script profess0r..

    i didn't understand the limitation "or all lines between the first and last occurrence of the SET "string" value will be removed." , can  explain further plz., with example, cuz i m really a noob  :D ... 

    ThanX

  2. I think whats going on is the sfx cannot find setup (executable) so its launching the \setup folder in system32 (PATH). Adding .EXE will force it to ONLY look for the executable and it will error if not found.

    Make sure you are compressing the files and not the folder with the files

    thanx rick.., i was actually compressing the folder with the files.., now it w0rked after compressing the files.., and i was already in doubt with that...!!

    thanx..!! :)

  3. hey rick.., d0nt know why, but your sfx maker is n0t creating a w0rking setup f0r me, i just properly foll0wed the steps and inserted the serial number in the bootstrap.lua and hide the serial input dialog of setup by replacing the 0 with 1, and created the final setup, but when i run this setup, nothing happens but the following path is opened: 

    C:\Windows\System32\Setup

    ., i d0nt know whats wr0ng with this, the pr0cedure is simple and i'm pretty sure that i'm not d0ing anything wr0ng..

    plx heLp...!!

      :help:

  4. I would create two hosts files (one with the facebook block and the other without)

    Put those two files anywhere you want and create a batch copy script where you would overwrite hosts file with your own each time you need to do that.

     

    I was going to try and make a script for you, but NIM's suggestion is actually the easiest way to do what you want.  That is because unlike batch's ability to easily add a line to a text file if needed, it can't easily delete a line.  What you end up having to do is copy the hosts file, leaving out the line(s) you want to "delete", delete the original hosts file, and rename the copied file to the original hosts file's name.  So just having two copies of the hosts file and copying, or renaming the one you want to use to the hosts file, whichever way you want to do it, ends up being an easier way to do it.

     

    Cheers and Regards

    still not what i want.., it will also restore my hosts file to its default,, so all the other sites that i have blocked will also become accessable.., e.g i hav blocked total uninstall for calling home, so my key doesn't get blacklisted.., and also i want the script to be universal...! btw thanx

    @bphlpt .. still if u can.., try once for me.., i shall be thankful...

  5. HelL0 guyz... neEd sum HeLp in batch..

     

    I hav a batch script that edits my hosts file, i use it to block facebook on my pc temporarily, becuz i want no one to use facebook on my pc except me..  happy.png , so when i'm done on my pc, i just run the batch script and facebook get blocked on my pc..

    and also i use it for some other purpose..

     

    Here is my batch script:

    Quote

     

    @ECHO OFF

     
    SET NEWLINE=^& echo.
     
    FIND /C /I "www.facebook.com" %WINDIR%\system32\drivers\etc\hosts
    IF %ERRORLEVEL% NEQ 0 ECHO %NEWLINE%^127.0.0.1 www.facebook.com>>%WINDIR%\system32\drivers\etc\hosts
     
    FIND /C /I "http://www.facebook.com/" %WINDIR%\system32\drivers\etc\hosts
    IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1http://www.facebook.com/>>%WINDIR%\system32\drivers\etc\hosts
     
    FIND /C /I "https://www.facebook.com/" %WINDIR%\system32\drivers\etc\hosts
    IF %ERRORLEVEL% NEQ 0 ECHO ^127.0.0.1https://www.facebook.com/>>%WINDIR%\system32\drivers\etc\hosts
     
    ipconfig /flushdns
     
    CLS
     
    EXIT
     
    So its just easy to edit my hosts file via this batch script, but its very annoying to revert the change, becuz to get facebook back, i hav to delete these lines from the hosts file, and i do it manually..
    So my question is;
    Is there anyway to delet specific lines from the hosts file with a single batch file like this one that add lines..?
    I think the above script needs a bit change but i dont know how.., all i know is that the above script first scans the hosts file for the specific line, if found then it ignores and proceed to next cammand, if not found then it adds the line.., there is the FIND command,, so i think after FIND command we can add a command something like DEL, so that it wil delete the line instead of adding it..
    but i cant do it, as i d0nt hav much experience in CMD..
    and plz do note that i hav anothr batch script that can delete the specific lines but it requires another .txt file which contains the lines.. and i want a single standalone .bat file like the one above that adds the line..
    Any help will be appreciated..
    And sorry if found my english bad....
    Thanx   smile.png

    Regards...

  6. first its speed is not going above 25kbps,, my speed is 480kbps, and after 30-35% downloading it stops and doesnt resume (with idm), tried with firefox default browser.., after downloading 7mb, firefox shoes download complete,, and when i run it, this error message appears "non 7z archive" ... but its obvious that if its downloaded only 7mb, not fully,, then it must have errors...!!

×
×
  • Create New...