windows - 如何在批处理脚本中检查文件/目录是否可写

标签 windows batch-file writable

在 bash 中,我会使用

[ -w ... ]

Windows 批处理文件的等效项是什么?

最佳答案

据我所知,你可以查到文件exists or not是否存在,但是除了尝试在上面写之外,没有办法知道它是否可写。这不仅仅是没有 R 标志的问题;还涉及网络和 NTFS 权限(可能还有组策略)。

如果您可以重写代码,则可以通过 errorlevel 捕获写操作的返回码.

关于windows - 如何在批处理脚本中检查文件/目录是否可写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1999988/

相关文章:

windows - Anaconda Spyder 4.1.5 更新

Java运行时exec不执行批处理脚本

variables - 如何在 min :sec format that uses a variable as the finishing time and uses the current time as the start time? 中创建批处理文件倒数计时器

batch-file - 批量命令行参数匹配

java - 如何在 groovy 中编写可写接口(interface)代码

C++ 从代码中编辑代码?

windows - 没有 bash/cygwin 的 git

javascript - 是否可以运行不在文件中的node.js脚本?

android - 如何在android中的sdcard中创建文件夹