CALL SET FOR

CALL 帮助文档 写道
Calls one batch program from another. #调用其他地方的一段batch程序

CALL [drive:][path]filename [batch-parameters] #<==命令使用格式

batch-parameters Specifies any command-line information required by the
batch program. #指定batch程度需要的命令行信息。

If Command Extensions are enabled CALL changes as follows:

CALL command now accepts labels as the target of the CALL. The syntax
is:
#Call命令接受字符串作为Call的目标。语法如下:

CALL :label arguments

A new batch file context is created with the specified arguments and
control is passed to the statement after the label specified. You must
"exit" twice by reaching the end of the batch script file twice. The
first time you read the end, control will return to just after the CALL
statement. The second time will exit the batch script. Type GOTO /?
for a description of the GOTO :EOF extension that will allow you to
"return" from a batch script.

#一个新的内容包含指定参数batch文件被创建,控制权is passed到指定文本的语句。你必须
“退出” 2次才到达batch脚本文件2次。第一次,你读到文件的末尾,控制权会转移到call后面的语句。
第一次会退出batch脚本。 Type GOTO /? 查看GOTO的描述 :EOF 拓展会运行你从一个batch脚本中
返回。

In addition, expansion of batch script argument references (%0, %1,
etc.) have been changed as follows:
另外,拓展的batch脚本参数引用已经改变如下:


%* in a batch script refers to all the arguments (e.g. %1 %2 %3
%4 %5 ...)

Substitution of batch parameters (%n) has been enhanced. You can
now use the following optional syntax:

%~1 - expands %1 removing any surrounding quotes (") #删除引号
%~f1 - expands %1 to a fully qualified path name #扩充到路径
%~d1 - expands %1 to a drive letter only #扩充到 盘符
%~p1 - expands %1 to a path only #扩充到 路径
%~n1 - expands %1 to a file name only #扩充到 文件名
%~x1 - expands %1 to a file extension only #扩充到 文件拓展类型
%~s1 - expanded path contains short names only #扩充到 路径包含的文件名
%~a1 - expands %1 to file attributes # 文件属性
%~t1 - expands %1 to date/time of file #文件时间
%~z1 - expands %1 to size of file #文件大小
%~$PATH:1 - searches the directories listed in the PATH
environment variable and expands %1 to the fully
qualified name of the first one found. If the
environment variable name is not defined or the
file is not found by the search, then this
modifier expands to the empty string

#查找文件目录列表在指定的PATH环境变量参数和拓展到第一次发现的【修饰名】。
如果环境变量名没有定义或者文件没有被搜索到,这个修改就会拓展成空字符串。

The modifiers can be combined to get compound results:
#修改可以被联合使用得到复合的结果。

%~dp1 - expands %1 to a drive letter and path only
%~nx1 - expands %1 to a file name and extension only
%~dp$PATH:1 - searches the directories listed in the PATH
environment variable for %1 and expands to the
drive letter and path of the first one found. #在环境变量中查找具有盘符和路径的文件夹列表
%~ftza1 - expands %1 to a DIR like output line

In the above examples %1 and PATH can be replaced by other
valid values. The %~ syntax is terminated by a valid argument
number. The %~ modifiers may not be used with %*
#在上面的例子中,%1 和 PATH可以用其他有效的值来代替。
%~ 语法 是以一个有效的数值参数结尾的。
%~修饰语不能使用%*

 

在使用 `FileUtils.setPermissions` 方法时,如果出现 `method not found` 的错误,通常意味着所使用的 `FileUtils` 类并不包含该方法,或者当前使用的 `FileUtils` 实现版本中不支持权限设置功能。 在标准的 Java `File` 类中,并没有直接提供设置文件权限的 API,而 Apache Commons IO 提供的 `FileUtils` 类也并不包含 `setPermissions` 方法[^1]。这意味着如果在代码中直接调用 `FileUtils.setPermissions`,而没有引入额外的扩展库或自定义实现,则会遇到编译错误或运行时异常。 如果确实需要设置文件权限,可以考虑以下几种方式: - 使用 Java NIO 的 `Files` 类与 `PosixFileAttributeView` 来设置权限,适用于支持 POSIX 的系统(如 Linux 和 macOS): ```java import java.nio.file.*; import java.io.IOException; public class FilePermissionExample { public static void main(String[] args) { Path file = Paths.get("/path/to/file"); try { PosixFileAttributeView view = Files.getFileAttributeView(file, PosixFileAttributeView.class); if (view != null) { view.setPermissions(java.util.EnumSet.of(PosixFilePermission.OWNER_READ, PosixFilePermission.OWNER_WRITE)); } } catch (IOException e) { e.printStackTrace(); } } } ``` - 如果使用的是 Android 平台,则可以参考 `Settings.java` 中创建目录和设置权限的方式[^3],利用 `FileUtils` 或其他方式设置文件权限。 - 自定义 `FileUtils` 实现,添加 `setPermissions` 方法以满足特定需求,例如通过调用本地命令(如 `chmod`)来修改文件权限。 - 检查是否引入了正确的 `FileUtils` 实现版本,确保其包含所需的 `setPermissions` 方法。 在开发过程中,应确保依赖库的版本一致性,并且理解所使用工具类的功能边界。如果发现 `FileUtils.setPermissions` 方法缺失,建议检查项目依赖配置,或者考虑采用上述替代方案之一来实现所需功能。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值