批处理 中的 ATTRIB函数

首页 / 批处理入门教程 / 批处理 中的 ATTRIB函数

显示或设置当前目录中文件的属性

ATTRIB - 语法

attrib

ATTRIB - 示例

以下示例显示了attrib命令的不同变体。

链接:https://www.learnfk.comhttps://www.learnfk.com/batch-script/batch-script-attrib.html

来源:LearnFk无涯教程网

@echo off
Rem Displays the attribites of the file in the current directory
Attrib

Rem Displays the attributes of the file lists.txt
attrib C:\tp\lists.txt

Rem Adds the "Read-only" attribute to the file.
attrib +r C:\tp\lists.txt
Attrib C:\tp\lists.txt

Rem Removes the "Archived" attribute from the file
attrib -a C:\tp\lists.txt
Attrib C:\tp\lists.txt

运行上面代码输出

无涯教程网

A           C:\tp\assoclst.txt
A           C:\tp\List.cmd
A           C:\tp\lists.txt
A           C:\tp\listsA.txt
A           C:\tp\lists.txt
A    R      C:\tp\lists.txt
     R      C:\tp\lists.txt

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

程序员进阶攻略 -〔胡峰〕

Android开发高手课 -〔张绍文〕

10x程序员工作法 -〔郑晔〕

从0开发一款iOS App -〔朱德权〕

Linux内核技术实战课 -〔邵亚方〕

打造爆款短视频 -〔周维〕

郭东白的架构课 -〔郭东白〕

零基础GPT应用入门课 -〔林健(键盘)〕

程序员职业规划手册 -〔雪梅〕

好记忆不如烂笔头。留下您的足迹吧 :)