Please stay on the list so that other people could answer and benefit from 
given answers.

\\cm-web01 is only the computer name. You need a given share like \\cm-web01\c$ 
. Otherwise you cant connect to it. Try that from the command line ... 
\\cm-web01 wont work. That's nothing from Ant, its the OS ...


Jan

 

>-----Ursprüngliche Nachricht-----
>Von: Yona Eilat [mailto:[EMAIL PROTECTED] 
>Gesendet: Mittwoch, 17. Oktober 2007 12:05
>An: Materne, Jan (RZF)
>Betreff: RE: Map a drive ("The ' characters around the 
>executable and arguments are not part of the command.")
>
>Many thanks for your answer.
>I run the command below and got the attached log:
>
><project>
>    <property name="drive" value="B:"/>
>    <property name="unc"  value="\\cm-web01"/>
>    
>    <exec executable="cmd.exe">
>        <arg line="/C NET USE ${drive} ${unc}"/>
>    </exec>
></project>
> 
>Is it ok?
>Shouldn't I see the drive map after the process?
>
>Yona 
>
>
>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
>Sent: Wednesday, October 17, 2007 09:49
>To: [email protected]
>Subject: AW: Map a drive ("The ' characters around the executable and
>arguments are not part of the command.")
>
>>I wrote the following simple code to map a NT drive to some path:
>>
>>      <target name="map_drive" depends="" description="-->
>description">
>>              <exec executable="cmd.exe">
>>                      <arg value="NET USE N: \\cm-web01"/>
>>              </exec>
>>      </target>
>>
>>And once I execute it, I get the following errors:
>>
>>      "The ' characters around the executable and arguments are not
>part of the command."
>
>
>Where is the problem? This is not an error message, it is just for
>information.
>Your log:
>
>Apache Ant version 1.7.0 compiled on December 13 2006
>Buildfile: C:\Documents and Settings\yonae\workspace\web_build\test.xml
>parsing buildfile C:\Documents and
>Settings\yonae\workspace\web_build\test.xml with URI =
>file:/C:/Documents%20and%20Settings/yonae/workspace/web_build/test.xml
>Project base dir set to: C:\Documents and
>Settings\yonae\workspace\web_build
>Build sequence for target(s) `map_drive' is [map_drive]
>Complete build sequence is [map_drive, full_build, ]
>map_drive:
>[antlib:org.apache.tools.ant] Could not load definitions from resource
>org/apache/tools/ant/antlib.xml. It could not be found.
>     [exec] Current OS is Windows XP
>     [exec] Executing 'cmd.exe' with arguments:
>     [exec] 'NET USE N: \\cm-web01'
>     [exec] 
>     [exec] The ' characters around the executable and arguments are
>     [exec] not part of the command.
>     [exec] Microsoft Windows XP [Version 5.1.2600]
>     [exec] (C) Copyright 1985-2001 Microsoft Corp.
>     [exec] C:\Documents and Settings\yonae\workspace\web_build>
>BUILD SUCCESSFUL
>Total time: 250 milliseconds
>
>
>
>The build finished successful, no error messages from/inside 
>cmd.exe ...
>
>
>I tried your code and there are two problems:
>1. use <arg line> instead of <arg value> because spaces must not be
>masked
>2. use a leading "/C" because cmd.exe needs that ...
>
>
><project>
>    <property name="drive" value="B:"/>
>    <property name="unc"  value="\\computer\share"/>
>    
>    <exec executable="cmd.exe">
>        <arg line="/C NET USE ${drive} ${unc}"/>
>    </exec>
></project>
>
>
>Tried out with 
>  $net use
>  $ant
>  $net use
>ant I could see that the drive was not connected before and was
>connected after the Ant run.
>
>
>
>If you want to encapsulate this command you could use <macrodef> for
>that.
>
><project>
>    <macrodef name="mapdrive">
>        <attribute name="drive"/>
>        <attribute name="unc"/>
>        <sequential>
>                       <exec executable="cmd.exe" taskname="mapdrive">
>                <arg line="/C NET USE @{drive} @{unc}"/>
>                       </exec>
>        </sequential>
>    </macrodef>
>
>    <macrodef name="unmapdrive">
>        <attribute name="drive"/>
>        <sequential>
>                       <exec executable="cmd.exe"
>taskname="unmapdrive">
>                <arg line="/C NET USE @{drive} /D"/>
>                       </exec>
>        </sequential>
>    </macrodef>
>
>    <target name="map">
>        <mapdrive drive="B:" unc="\\L011benutzer\f007777"/>
>    </target>
>    <target name="unmap">
>        <unmapdrive drive="B:"/>
>    </target>
></project>
>
>
>
>Next step would be a "windows AntLib" .... ;)
>
>
>
>Jan
>
>
>
>
>
>Jan
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
Apache Ant version 1.7.0 compiled on December 13 2006
Buildfile: C:\Documents and Settings\yonae\workspace\web_build\test.xml
parsing buildfile C:\Documents and Settings\yonae\workspace\web_build\test.xml 
with URI = 
file:/C:/Documents%20and%20Settings/yonae/workspace/web_build/test.xml
Project base dir set to: C:\Documents and Settings\yonae\workspace\web_build
[antlib:org.apache.tools.ant] Could not load definitions from resource 
org/apache/tools/ant/antlib.xml. It could not be found.
     [exec] Current OS is Windows XP
     [exec] Executing 'cmd.exe' with arguments:
     [exec] '/C'
     [exec] 'NET'
     [exec] 'USE'
     [exec] 'B:'
     [exec] '\\cm-web01'
     [exec] 
     [exec] The ' characters around the executable and arguments are
     [exec] not part of the command.
     [exec] System error 53 has occurred.
     [exec] The network path was not found.
     [exec] Result: 2
BUILD SUCCESSFUL
Total time: 281 milliseconds
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to