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

Advanced commands in bat batch configuration of icacls permissions

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Only you can't think of it, it's not impossible, it's just that you can't get through the way of thinking in your world for the time being; personally, you can't judge whether a language is powerful or not unilaterally, that's because you don't know it well enough, and you don't have a complete grasp of the essence.

Any language has its advantages in development, but we need to compromise and choose, things need to be chosen, our minds diverge, and things (things) communicate with each other as much as possible. Sometimes we do not understand many things for the time being, fall into a bottleneck, through a period of exploration and practice (not limited to this thing), we suddenly find that we have understood the wonderful things, the wonders of the world, the wonders of the world, and even a thousand ideas, but at some point we begin to form a line.

After talking so much, saying a truth seems to be nonsense. I digest it by myself. I haven't written a BAT command for a long time. Let's get to the topic and do a BAT demonstration. There is a batch code on the so-and-so server. Now you need to clean up the * (replace the file specified in the server config.php) in the file. In order to prevent this situation from recurring, write this file is prohibited. In this case, the entire scene of the case is reproduced with BAT at 1:1.

Site creation:

:: Author: jerry

@ echo off

Set pathwww= "E:\ wwwroot"

For / f% I in (web.txt) do (

Echo I

Mkdir% pathwww%\% I\ web > > log.txt

)

Echo. & pause

Site list

Create a list of effects

Data replication and replacement (note directory change):

:: Author: jerry

@ echo off

Set pathwww= "E:\ wwwroot"

For / f% I in (web.txt) do (

Echo I

Xcopy "E:\ bak\ web\% i.rar" / k "E:\ bak\ new\" / y > log.txt

)

Echo. & pause

Build site users in batches:

:: Author: jerry

@ echo off

Set pathwww= "E:\ wwwroot"

For / f% I in (web.txt) do (

Echo I

Net user I / add > > userlog.txt

)

Echo. & pause

View the user created under: net user

Volume Licensing:

Display before the site file is not authorized:

Volume Licensing script:

@ echo off

:: author: by jerry

Set pathwww= "E:\ wwwroot"

For / f "usebackq tokens=1 delims="% an in (web.txt) do call: qx% a

Pause

: qx

Set webname=%1%

Icacls% pathwww%\% webname%\ web\ config.php / grant% webname%: (rx) > > chmod.log

Icacls pathwww%\% webname%\ web\ config.php / deny% webname%: (w) > > chmod.log

Echo. & pause

Demonstrate the completion of cleaning account information, clean up site script:

:: Author: jerry

@ echo off

Set pathwww= "E:\ wwwroot"

For / f% I in (web.txt) do (

Echo I

Net user I / delete > > dellog.txt

Rd% pathwww%\% I / Q / s

)

Echo. & pause

The content has also been cleaned up:

The case is demonstrated with code at 1:1 around the entire life cycle from site directory creation, data replication (override), site user creation, permission configuration, permission change, to site account and overall site deletion. At the end of the whole operation, I talked about a lot of key points: icacls, a convenient advanced cargo command application, which is usually a little bit and seldom used.

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

Servers

Wechat

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

12
Report