Create .bat or .cmd



Rep: (146)
Good afternoon, I needed to add social networks to the blacklist by adding ip to the hosts file.
As practice has shown, adding addresses to the blacklist in the antivirus is not effective.
So I want to do this: there is a hosts file, make bat or exe to replace the original file with mine
Because hands climb in win / system / drivers / etc for a very long time ...
Well, or at least a hint how to do it easier



Rep: (146)
Manually added lines to hosts, kis 2012 restored the old hosts file, how to wean it from this?))

127.0.0.1 vk.com
127.0.0.1 www.vk.com
127.0.0.1 odnoklassniki.ru
127.0.0.1 www.odnoklassniki.ru
127.0.0.1 my.mail.ru
127.0.0.1 www.my.mail.ru

added these lines. I solved the problem this way: disabled Kaspersky, made changes, turned on Kaspersky.

Post has been editedLeliil - 23.12.12, 14:45



Rep: (2118)
Leliil,
but not easier like that?
Set a password to change the settings in KIS 2012. To do this, open KIS, go toSettings ->Main settings ->Enable password protection - Setting ... ->Put all the checkmarks and enter the password twice,which only we know
Attached Image
Attached Image
Attached Image
Attached Image

  1. If the one from whom we are blocking the site tries to get into Casper and remove the site from the anti-banner, the program will ask for a password and nothing will come of it.
  2. If they try to close or stop Casper, he will also ask for a password!
  3. If someone wants to remove Casper, then it will fail again, since it will be necessary to enter a password that we only know

Farther:Anti Banner ->Check the box "Enable Anti-Banner" ->Check the box "Use the list of prohibited web addresses" ->Setting ... ->Add vk.com (for example) ->Ok ->To apply

Post has been editedGloomy - 23.12.12, 15:06



Rep: (6)
I can assume that in Safe Mode Kaspersky does not start? If so, then this is in our hands.

bat file:

copy hosts C: \ path \ hosts
pause


We load Safe Mode (f8 at boot), we launch.

It should work, although I do not know, I have not tried it. Run from the admin.

Also: I have an assumption that you are playing the role of a system administrator. If this is the case, then I could recommend making a separate account for users (if not), put the password on the admin and cut off the hands of users through gpedit.msc, put the password on Kaspersky. If this already exists, then I apologize - I could not know. Good luck in this business!

Post has been editedSergey305 - 23.12.12, 20:43



Rep: (146)
The fact is that Kis 2012 resets the password ... that is, I set my password, and after rebooting it does not work, I have to reset it through safe mode. Therefore, no way through kitty ... and if I change hosts with my hands, kitty will automatically restore it.
on the 3rd pc such a story): on the 2nd license, on the 3rd German kitty 2012 with the key from computerbild
But I don’t know where he gets it from, because what I entered before - everything remains, even he replaces a clean file with mine, but the changes are not saved in it

Download Safe Mode

Well, it doesn’t work out very quickly)) then we will set the password on Kaspersky, when there is a need to change the settings - reset the password))
but don’t know how to disable hosts file control?

Found how to solve the problem with blocking the hosts file))
http://www.woinfo.ru/publ/23-1-0-227

Bottom line: added to the black list in kitty and in hosts.
Users of these PCs will not climb into the wilds, I hope)) if they climb, you will have to set a password
Over time, I’ll do some accounting, it’s just too late to change anything)) or it will start, it’s not that, it’s not that ...

Post has been editedLeliil - 25.12.12, 23:20



Rep: (25)
Is it possible to write a batch file, which with its launch brings certain addresses to the host file, and a batch file, which removes them from the host file? I'd love to, sometimes I have to perform these actions several times a day.



Rep: (2704)
Spied in the "adobovsky" patch: D
@ECHO OFF
TITLE Social Network Address Blocking

ECHO Lock in hosts address file
ECHO social networks
ECHO _______________________________________________________________________
Echo.
REN% WINDIR% \ system32 \ drivers \ etc \ hosts hosts77>nul
IF% ERRORLEVEL% NEQ 0 (
ECHO The hosts file is locked for editing.
Echo.
ECHO Or you didn’t run this patch as an administrator,
ECHO or making changes blocks your installed antivirus.
Echo.
Echo.
PAUSE
EXIT
)
REN% WINDIR% \ system32 \ drivers \ etc \ hosts77 hosts>nul
FIND / c / i "odnoklassniki.ru"% WINDIR% \ system32 \ drivers \ etc \ hosts>nul
IF% ERRORLEVEL% NEQ 0 (
Echo.>>% WINDIR% \ system32 \ drivers \ etc \ hosts
ECHO ^ 127.0.0.1 odnoklassniki.ru>>% WINDIR% \ system32 \ drivers \ etc \ hosts
ECHO Address odnoklassniki.ru has been successfully added to the hosts file.
) ELSE (
ECHO The address odnoklassniki.ru is already in the hosts file.
)
Echo.
FIND / c / i "vk.com"% WINDIR% \ system32 \ drivers \ etc \ hosts>nul
IF% ERRORLEVEL% NEQ 0 (
ECHO ^ 127.0.0.1 vk.com>>% WINDIR% \ system32 \ drivers \ etc \ hosts
ECHO Address vk.com has been successfully added to the hosts file.
) ELSE (
ECHO The address vk.com is already in the hosts file.
)
Echo.
FIND / c / i "vkontakte.ru"% WINDIR% \ system32 \ drivers \ etc \ hosts>nul
IF% ERRORLEVEL% NEQ 0 (
ECHO ^ 127.0.0.1 vkontakte.ru>>% WINDIR% \ system32 \ drivers \ etc \ hosts
ECHO Address vkontakte.ru was successfully added to the hosts file.
) ELSE (
ECHO The address vkontakte.ru is already in the hosts file.
)
Echo.
FIND / c / i "facebook.com"% WINDIR% \ system32 \ drivers \ etc \ hosts>nul
IF% ERRORLEVEL% NEQ 0 (
ECHO ^ 127.0.0.1 facebook.com>>% WINDIR% \ system32 \ drivers \ etc \ hosts
ECHO The address facebook.com has been successfully added to the hosts file.
) ELSE (
ECHO The address facebook.com is already in the hosts file.
)
Echo.
ipconfig / flushdns>nul
ECHO DNS resolver cache flushed successfully.
ECHO _______________________________________________________________________
Echo.
ECHO All necessary changes successfully made!
Echo.
Echo.
PAUSE

OEM 866 encoding
Delete .txtAttached fileHOSTS.cmd.txt(1.98 KB)


Post has been editedShoore - 04.04.14, 15:54



Rep: (20)
Write a batch file with a choice for the command line (windows) so that when you press the number 1 the command passes

netsh wlan start hostednetwork


Number 2

netsh wlan stop hostednetwork


Number 3

netsh wlan set hostednetwork mode = allow ssid = Huskvarna key = 2727627276zed


P.S. Commands are connected with activation / deactivation and creation of a wi fi access point, otherwise it cannot be done with hardware on windows 8



Rep: (2704)
@echo off
echo 1 - To fulfill your first wish, press 1
echo 2 - To stop fulfilling your first wish, press 2
echo 3 - To set the first desire, press 3
set / p var = "Enter a number here:"
@if "% var%" == "1" goto first
@if "% var%" == "2" goto second
@if "% var%" == "3" goto third
: first
netsh wlan start hostednetwork
exit
: second
netsh wlan stop hostednetwork
exit
: third
netsh wlan set hostednetwork mode = allow ssid = Huskvarna key = 2727627276zed
exit


Whether I work or not, I don’t knowhere

Post has been editedShoore - 14.09.14, 04:02



Rep: (0)
I haven’t sculpted scripts for a long time, I decided to blind too :)

hosts2. - what we replace the original hosts with. (put 5 large social networks, did not fool)
install.cmd - installer / uninstaller of the whole thing just by clicking
a.cmd - off / on of our hosts after installation. It is copied to the system32 folder during installation and launched by the letter A from the console.

run everything naturally under the admin

Attached files

Attached filelepeshka.zip(1.41 KB)



Rep: (3)
Hello everyone! Maybe not in the subject, but I don’t know where to write ((
Nuden a batch file that would launch a game, and at the same time stop a couple of programs
Very necessary!



Rep: (2704)
@echo off
WMIC PROCESS WHERE Name = "utorrent.exe" CALL Terminate
WMIC PROCESS WHERE Name = "notepad.exe" CALL Terminate
WMIC PROCESS WHERE Name = "some_lazy_user.exe" CALL Terminate
start "C: \ Program Files \ Game \ game.exe"



Rep: (3)
Everything closes, but the game does not start, what could be the matter?


Post has been editedroman750 - 09.02.15, 20:35



Rep: (2704)
Roman750 @ 02/09/2015, 20:32*
What can be wrong?
The path to the game executable is not registered, the folder is not the way.



Rep: (0)
* roman750

go to the folder with the game, where the startup file
copy the address at the top of the window and add to the end of the batch file, which you wrote above like this:
cd "address"
the address in double quotes is required!

next line is the name of the file that you are running
.exe at the end is optional! ;)

___ can be closed anyway, less scribble = D
taskkill / f / im utorrent.exe
taskkill / f / im Cloud.exe
taskkill / f / im punto.exe

Post has been editedjeromy1 - 09.02.15, 22:18



Rep: (3)
But how can I launch several programs with one batch file, those that I closed earlier?



Rep: (2704)
Jeromy1 @ 02/09/2015, 21:59*
less scribble
I like WMIC more :) you might think someone will write it with his hands, then he’s already getting insanity, I’m copying the points: D

how to launch several programs with one batch file
As well as closing ...
@echo off
WMIC PROCESS WHERE Name = "utorrent.exe" CALL Terminate
WMIC PROCESS WHERE Name = "Cloud.exe" CALL Terminate
WMIC PROCESS WHERE Name = "punto.exe" CALL Terminate
start / wait "C: \ Users \ ROMAN \ Desktop \ Warface.ink"
start% AppData% \ Roaming \ Utorrent \ utorrent.exe
start "% AppData% \ Roaming \ Yandex \ Punto Switcher \ PuntoSwitcher.exe"
start "C: \ Program Files \ Cloud \ cloud.exe"


Post has been editedShoore - 09.02.15, 23:57



Rep: (2704)
Jeromy1 @ 02/09/2015, 21:59*
copy the address at the top of the window
Usefullife hacktweak, what would not be perverted
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT \ * \ shell \ Windows.copyaspath]

"VerbName" = "copyaspath"
"CommandStateSync" = ""
"InvokeCommandOnSelection" = dword: 00000001
"MUIVerb" = "@ shell32.dll, -30329"
"VerbHandler" = "{f3d06e7c-1e45-4a26-847e-f9fcdee59be0}"
"Description" = "@ shell32.dll, -30336"
"CanonicalName" = "{707C7BC6-685A-4A4D-A275-3966A5A3EFAA}"
"CommandStateHandler" = "{3B1599F9-E00A-4BBF-AD3E-B3F99FA87779}"
"Icon" = "imageres.dll, -5302"

Attached Image



Rep: (3)
Something does not work, it closes, but does not start (


Post has been editedroman750 - 10.02.15, 16:59



Rep: (2704)
Roman750 @ 02/10/2015, 16:56*
closes but does not start
Announce the full batch file code.


Full version    

Help     rules

Now: 09/01/19, 09:08