3

我们正在使用 Nant 部署应用程序,需要确保在此过程中创建共享。

我们使用psexecandnet share来创建共享,但是如果共享已经存在,这将失败并停止 Nant。

有什么方法可以检测到共享已经存在?

在尝试创建共享之前或能够检测到的返回代码2The name has already been shared来自的消息psexec

我试过directory::exists了,但这总是返回错误。

我尝试将文件复制到远程目录,file::exists但这总是返回 false。

4

1 回答 1

3

看来我的变量和路径有问题:

<echo message="exists!" if="${directory::exists('\\${server}\share')}"/>

不起作用,但是:

<property name="test" value="\\${server}\share" />
<echo message="exists!" if="${directory::exists(test)}"/>

工作正常!

于 2010-07-06T09:10:07.167 回答