Under Windows systems, files with the extension Cmd/bat are called batch files. Can be used to do repetitive work, but also can be used to do something with the mouse can not (fast) to complete the work. I've been studying it since I had my first computer. However, my enthusiasm for learning has come to an end because of work and personal quirks, but it is undeniable that it is indeed useful.
Pull away and get back to the chase. I saw a few batches of files on my computer and I couldn't use them for the time being. Delete it, afraid to use it in the future, do not delete it, look upset. So all copied here, to their own spare, but also to share to everyone.
This article is not updated regularly ...
Note: This code is executed in the ". cmd" file without special instructions.
Encrypt Batch Code
This code source has been forgotten, only remember is extracted from a bat to exe tool. Used to be fascinated by the general computer users can not see their own writing code, now think, there is no need. After all, so-called encryption, but also just transcoding, so that "notepad" turned on display as garbled only.
@IFnot EXIST "%~f1" (EXITELSE (ECHOexitCMD PROMPT E100 FF FE 6C 0D 0A $_rcx$_9$_n TMP. k$_w$_q$_| DEBUG) && @COPYDEL TMP. K
fix "word has problems requiring shutdown and safe mode"
That year, I was still using the XP system and Microsoft Office 2003, and that was the year I met this problem, from the "Niang" there to find the answer, delete the template is good. And then wrote this batch of backup.
@IFEXISTDELEXIT
Turn off default sharing
Or that year, XP system installed, it seems there will always be "C $, d$ ... admin$ "such as default sharing, I heard that the security problem is very serious, although you can use the" NET "command to delete the share, but the symptoms do not cure. The solution to the root causes is to modify the registry ...
@ECHO OFF REM turn off disk default sharing REG ADD hkey_local_machine\system\currentcontrolset\services\lanmanserver\parameters/v autoshareserver/t REG_DWORD /d 0/FREM off admin$ default shared REG ADD hkey_local_machine\system\currentcontrolset\services\ lanmanserver\parameters/v autosharewks/t reg_dword/d 0/f
disabling properties for local connections
Once worked in a studio, when only the boss computer can be networked. And then, clever my witty discovery changed the MAC address to be networked like a boss computer. After a wave of changes to the MAC address, was announced by the boss, can no longer let others modify the MAC address. Then forced to disable the "Local Area Connection" property on the other computer ...
@regsvr32/S/u netcfgx. /s/u Netman. /s/u Netshell.dll
MAC address Modification
I have been a very "lazy" people, in order to steal the net, found the properties of the "local connection" to modify the MAC address method, and then think, every time the change so troublesome, so write a batch to modify the MAC address (not to mention in response to the boss call, the local connection properties to disable it). It is necessary to note that this batch, is also born under the XP system, Win7 system, may need to be slightly modified. [need to use Devcon.exe]
@ECHO OFFIPCONFIG |FIND"Media disconnected" >nul 2>nul &&Pager : ERROR1SETLOCALenabledelayedexpansion for/F "skip=3 Tokens=1 delims="%%i In (' Getmac ') Do(SETmacnum=%%iSETmacnum=! macnum:-=! ECHO.ECHOPlease enter a correct MAC address, example native MAC address is:! macnum! ECHO.ECHO(Hint: The MAC address is only made up of numbers and letters, and is 12 bits)ECHO.)SETLOCALdisabledelayedexpansionSET/P number=Enter a 12-bit MAC address here:: BEGINIF notDEFINED numberPager : ERROR2SETKey1=hkey_local_machine\system\controlset001\control\class\{4D36E972-E325-11CE-BFC1-08002BE10318}SETKey2=hkey_local_machine\system\controlset002\control\class\{4D36E972-E325-11CE-BFC1-08002BE10318}SETKey3=hkey_local_machine\system\currentcontrolset\control\class\{4D36E972-E325-11CE-BFC1-08002BE10318}SETKey4=ndi\params for/L%%i In (1 1 20) Do(IF%%i LEQ 9 (REG QUERY%key1%\000%%i\%key4% >nul 2>nul && REG ADD%key1%\000%%i/v networkaddress/t reg_sz/d%number%/F >NUL 2>NUL REG QUERY%key2%\000%%i\%key4% >nul 2>nul && REG ADD%key2%\000%%i/v networkaddress/t reg_sz/d%number%/F >NUL 2>NUL REG QUERY%key3%\000%%i\%key4% >nul 2>nul && REG ADD%key3%\000%%i/v networkaddress/t reg_sz/d%number%/F >NUL 2>NUL)IF%%i GEQ 10 (REG QUERY%key1%\00%%i\%key4% >nul 2>nul && REG ADD%key1%\00%%i/v networkaddress/t reg_sz/d%number%/F >nul 2>NUL REG QUERY%key2%\00%%i\%key4% >nul 2>nul && REG ADD%key2%\00%%i/v networkaddress/t reg_sz/d%number%/F >nul 2>NUL REG QUERY%key3%\00%%i\%key4% >nul 2>nul && REG ADD%key3%\00%%i/v networkaddress/t reg_sz/d%number%/F >nul 2>NUL)) for/F "delims=: tokens=2"%%i In (' Ipconfig/all ^|FIND"Description") Do( for/F "delims=^& tokens=2"%%j in (' DEVCONFINDpci\* ^|FIND"%%i") DoDEVCON RESTART *%%j* >nul 2>NULIF ERRORLEVEL1Pager : ERROR3IF ERRORLEVEL0 (ECHO.ECHORestart nic Success ...ECHO. ))GOTOQUIT: ERRORECHO.IF %1EQU 1ECHOThe network cable is unplugged, or the NIC driver is not installed, please check the Internet connection! IF %1EQU 2ECHOUnknown MAC address! IF %1EQU 3ECHOThe NIC restart failed, manually re-enable the network connection, or restart the computer. && NCPA.CPLECHO.GOTOQUIT: QUITPAUSEEXIT
MAC address Recovery
Doing things in pairs is good, there are changes to have to recover. [need to use Devcon.exe]
@ECHO OFFSETKey1=hkey_local_machine\system\controlset001\control\class\{4D36E972-E325-11CE-BFC1-08002BE10318}SETKey2=hkey_local_machine\system\controlset002\control\class\{4D36E972-E325-11CE-BFC1-08002BE10318}SETKey3=hkey_local_machine\system\currentcontrolset\control\class\{4D36E972-E325-11CE-BFC1-08002BE10318}SETKey4=ndi\params for/L%%i In (1 1 20) Do(IF%%i LEQ 9 (REG QUERY%key1%\000%%i\%key4% >nul 2>nul && REG DELETE%key1%\000%%i/v networkaddress/f >nul 2>Nulreg QUERY%key2%\000%%i\%key4% >nul 2>nul && REG DELETE%key2%\000%%i/v networkaddress/f >nul 2>Nulreg QUERY%key3%\000%%i\%key4% >nul 2>nul && REG DELETE%key3%\000%%i/v networkaddress/f >nul 2>NUL)IF%%i GEQ 10 (REG QUERY%key1%\00%%i\%key4% >nul 2>nul && REG DELETE%key1%\00%%i/v networkaddress/f >nul 2>Nulreg QUERY%key2%\00%%i\%key4% >nul 2>nul && REG DELETE%key2%\00%%i/v networkaddress/f >nul 2>Nulreg QUERY%key3%\00%%i\%key4% >nul 2>nul && REG DELETE%key3%\00%%i/v networkaddress/f >nul 2>NUL)) for/F "delims=: tokens=2"%%i In (' Ipconfig/all ^|FIND"Description") Do( for/F "delims=^& tokens=2"%%j in (' DEVCONFINDpci\* ^|FIND"%%i") DoDEVCON RESTART *%%j* >nul 2>NULIF ERRORLEVEL1ECHOThe NIC restart failed, manually re-enable the network connection, or restart the computer. && NCPA.CPLIF ERRORLEVEL0ECHORestart nic Success ...)PAUSEEXIT
Limit local user logon time
This, the use is not very big, in fact, is mainly used to prevent "small white" (Do not spray, I am also a small white AH) use their own computer in the company. So limit the start-up time is only 8 O ' Day in the morning to 6 in the afternoon.
@NET USER%USERNAME%/time: m,8am-6pm; t,8am-6pm; w,8am-6pm; th,8am-6pm; f,8am-6pm; sa,8am-6pm; Su,8am-6pm
CMD Script App Collection