Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use batch processing to realize fixed IP address, automatic login of the system, and locking the computer after login.

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail how to use batch processing to achieve a fixed IP address, the system automatically logs in, and locks the computer after logging in. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

IP address can be entered and loaded, that is to say, after entering once, it can be loaded directly without manual input.

There is no copyright, reprint leave a name, after all, even if the copy is also a lot of lines, the logic is still very difficult to figure out.

Echo off

Mode con: cols=75 lines=20

Title Mini Program Power By-Fox-Guy

: oder

Color 1d

Cls

Rem menu item

Echo ╔┉┉╗

Echo ┋ is purely accidental, ┋.

Echo ┋ ┋

Echo ┋ ┋

Echo ┋ MY Space http://hi.baidu.com/xixilikexixi ┋

Echo ┋ ┋

Echo ┋ a. The user automatically logs in b. Automatically lock ┋ after the system logs in

Echo ┋ ┋

Echo ┋ c. The system changes the IP setting d. Exit ┋

Echo ┋ ┋

Echo ┋ ┋

Echo ╚┉┉╝

Set c =

Set / p c = Select and enter:

If / I "% c%" = "a" goto auto

If / I "% c%" = = "b" goto lock

If / I "% c%" = = "c" goto setip

If / I "% c%" = = "d" goto exit

: auto

Cls

Set user=

Set / p user= Please enter a user name:

Set pass=

Set / p pass= Please enter your password:

If exist auto.reg del auto.reg

Echo Windows Registry Editor Version 5.00 > auto.reg

Echo. > > auto.reg

Echo [HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows NT\ CurrentVersion\ Winlogon] > > auto.reg

Echo "DefaultUserName" = "% user%" > > auto.reg

Echo "AutoAdminLogon" = "1" > > auto.reg

Echo "Defaultpassword" = "% pass%" > > auto.reg

Regedit / s auto.reg

Del / f / q auto.reg

Automatic login settings for echo users are complete.

Ping-n 5 127.1 > nul

Goto oder

: lock

If exist lock.bat del lock.bat

If exist run.vbs del run.vbs

Echo @ echo off > lock.bat

Echo rundll32 user32.dll LockWorkStation > > lock.bat

Echo exit > > lock.bat

Echo DIM objShell > run.vbs

Echo set objShell=wscript.createObject ("wscript.shell") > > run.vbs

Echo iReturn=objShell.Run ("lock.bat", 0, TRUE) > > run.vbs

Copy lock.bat% windir%\ system32\ / y

Copy run.vbs% windir%\ system32\ / y

Reg add HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ Run / v West West system Lock / d% windir%\ system32\ run.vbs / f

Del / f / q lock.bat

Del / f / q run.vbs

The setting of automatic lock after echo system login is complete.

Ping-n 5 127.1 > nul

Goto oder

: setip

: oderip

Cls

Rem menu item

Echo ╔┉┉╗

Echo ┋ is purely accidental, ┋.

Echo ┋ ┋

Echo ┋ ┋

Echo ┋ MY Space http://hi.baidu.com/xixilikexixi ┋

Echo ┋ ┋

Echo ┋ a. Enter IP configuration b. Load IP configuration ┋

Echo ┋ ┋

Echo ┋ c. Delete all IP configurations d. Return to ┋

Echo ┋ ┋

Echo ┋ ┋

Echo ╚┉┉╝

Set c =

Set / p c = Select and enter:

If / I "% c%" = "a" goto lr

If / I "% c%" = = "b" goto jz

If / I "% c%" = = "c" goto delset

If / I "% c%" = = "d" goto oder

: jz

Cls

If exist xixi.txt del xixi.txt

If exist 1.txt del 1.txt

Find configuration windir%\ xixi.ini > xixi.txt

FOR / F "eol=; tokens=2 delims=:"% I in (xixi.txt) do (

Echo I > > 1.txt

)

Del / f / q xixi.txt

If exist 1.txt (goto jz1) ELSE echo is not currently configured! Please try to enter. & ping-n 5 127.1 > nul & goto oderip

: jz1

Cls

Echo you currently have the following configurations: & type 1.txt

Echo.

Set j =

Set / p j = do you want to load the existing IP configuration? (y _ map N):

If / I "% j%" = = "N" goto oderip

Set jname=

Set / p jname= Please enter the name of the IP configuration you want to load:

Echo.

Echo.

The configuration to be loaded by echo is:% jname%

If exist N.txt del N.txt

Find "% jname% connection name"% windir%\ xixi.ini > N.txt

For / f "skip=2 tokens=3" N in (N.txt) do set name=%%N

Echo connection name:% name%

If exist I.txt del I.txt

Find "% jname% IP address"% windir%\ xixi.ini > I.txt

For / f "skip=2 tokens=3"% I in (I.txt) do set ip=%%I

Echo IP address:% ip%

If exist Z.txt del Z.txt

Find "% jname% subnet mask"% windir%\ xixi.ini > Z.txt

For / f "skip=2 tokens=3" Z in (Z.txt) do set mask=%%Z

Echo subnet mask:% mask%

If exist M.txt del M.txt

Find "% jname% default gateway"% windir%\ xixi.ini > M.txt

For / f "skip=2 tokens=3"% M in (M.txt) do set gateway=%%M

Echo default gateway:% gateway%

If exist S.txt del S.txt

Find "% jname% preferred DNS"% windir%\ xixi.ini > S.txt

For / f "skip=2 tokens=3"% S in (S.txt) do set dns1=%%S

Echo preferred DNS:%dns1%

If exist B.txt del B.txt

Find "% jname% standby DNS"% windir%\ xixi.ini > B.txt

For / f "skip=2 tokens=3"% B in (B.txt) do set dns2=%%B

Echo backup DNS:%dns2%

Del / f / q 1.txt

Del / f / q N.TXT

Del / f / q I.TXT

Del / f / q Z.TXT

Del / f / q M.TXT

Del / f / q S.TXT

Del / f / q B.TXT

Echo.

Echo.

Set c =

Set / p c = load complete! Now do you want to start setting up? (YUnip N):

If / I "% c%" = = "n" goto oderip

Goto set

: lr

Cls

Set pname=

Set / p pname= Please enter the connection name (e. G. IP configuration at home):

Set name=

Set / p name= Please enter the connection name (e.g. local connection):

Set ip=

Set / p ip= Please enter the IP address (e.g. 192.168.0.2):

Set mask=

Set / p mask= enter the subnet mask (for example: 255.255.255.0):

Set gateway=

Set / p gateway= Please enter the gateway (e.g. 192.168.0.1):

Set dns1=

Set / p dns1= Please enter the preferred DNS (e.g. 61.128.128.68):

Set dns2=

Set / p dns2= Please enter a backup DNS (e.g. 202.202.145.5):

Echo.

Echo.

Does echo need to save this configuration? If you save the next use, you can load this configuration directly without manual input.

Set s =

Set / p / s = (YUnip N):

If / I "% s%" = "Y" goto save

: set

Cls

Netsh interface ip set address name= "name%" source=static addr=%ip% mask=%mask%

Echo IP and subnet mask settings are complete.

Netsh interface ip set address name= "name%" gateway=%gateway% gwmetric=0

Echo gateway setup is complete.

Netsh interface ip set dns name= "name%" source=static addr=%dns1% register=PRIMARY

Echo DNS1 setup is complete.

Netsh interface ip add dns name= "name%" addr=%dns2%

Echo DNS2 setup is complete.

Netsh interface ip set wins name= "name%" source=static addr=none

Goto oderip

: save

Cls

Echo configuration:% pname% > >% windir%\ xixi.ini

Echo% pname% connection name:% name% > >% windir%\ xixi.ini

Echo% pname% IP address:% ip% > >% windir%\ xixi.ini

Echo% pname% subnet mask:% mask% > >% windir%\ xixi.ini

Echo% pname% default gateway:% gateway% > >% windir%\ xixi.ini

Echo% pname% preferred DNS:% dns1% > >% windir%\ xixi.ini

Echo% pname% standby DNS:% dns2% > >% windir%\ xixi.ini

Echo. > >% windir%\ xixi.ini

Echo saved successfully.

Ping-n 3 127.1 > nul

Set s =

Set / p s = do you need this set of configuration settings? (Ybig N):

If / I "% s%" = "Y" goto set

Goto oderip

: delset

Cls

Del / f / Q% windir%\ xixi.ini

Echo deletion completed.

Ping-n 5 127.1 > nul

Goto oderip

On "how to use batch processing to achieve a fixed IP address, the system automatically login, lock the computer after logging in" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report