Hi everyone! I hope someone can tell me what I'm doing wrong. I'm running ActivePerl 5.6 on an NT4 (service pack 5) box.
One of the things I have to do is to have a Perl script "map" a network drive to a drive letter. When one manually does this from the command line, it is done using the "net use" command, specifying as parameters the destination drive letter (or a wildcard to get the first available one) and the network drive. I'm trying to do this by calling system() from my Perl script, but the call to system() fails. However, if I type the same command at the command line, it works. I thought at first that I might not be correctly invoking the system() function, but I am able to use it to have the "dir" command executed. Shown below is the source of my test program: #***** START OF TEST PROGRAM use strict; use warnings; use diagnostics; # For unbuffered I/O. $| = 1; # Set up the arguments for the calls to system(). my( @sysargs0 ) = ( 'dir', '..' ); my( @sysargs1 ) = ( 'net use', '*', '\\\\rndnt55\\rndapps' ); # Just do a call to the Win32's "dir .." command. # Works OK. system( @sysargs0 ) == 0 or die( "system( \@sysargs0 ) failed: $?" ); # For verification, see what system() is receiving. for( my $i = 0; $i <= $#sysargs1; $i++ ) { print( "\t\$sysargs1[ $i ] = $sysargs1[ $i ]\n" ); } # This call to Win32's "net use" fails. !?!?! if( system( @sysargs1 ) != 0 ) { my( $exitValue ) = $? >> 8; my( $signalNum ) = $? & 127; my( $dumpedCore ) = $? & 128; print( "\t\$exitValue = $exitValue\n" ); print( "\t\$signalNum = $signalNum\n" ); print( "\t\$dumpedCore = $dumpedCore\n" ); die( "system( \@sysargs1 ) call failed: $?" ); } #***** END OF TEST PROGRAM ************************************************************************ Francoys Crepeau Ottawa, Ontario, Canada mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]