Hi, Sometimes the "net use /d Z:" command returns: There are open files and/or incomplete directory searches pending on the connection to Z: Is it OK to continue disconnecting and force them closed? (Y/N) [N]: I want to use this command in...
Hi,
Sometimes the "net use /d Z:" command returns:
There are open files and/or incomplete directory searches pending on the connection to Z:
Is it OK to continue disconnecting and force them closed? (Y/N) [N]:
I want to use this command in a script and automatically supply Y.
I have discovered the following 2 things:
1. The following does NOT work with net use either from a command window or in a DOS bat file:
net use /d Z: < y.dat
where y.dat contains Y followed by a newline character.
2. The following, however, does work both from a command window and from a DOS bat file
echo Y | net use /d Z:
However, I am trying to do this from a Perl script.
Neither of the following system calls work:
system ("echo Y | /d Z:");"
nor
`"echo Y | /d Z:"`
(I have also tried escaping the pipe character, i.e. tried using \|.
Apparently piping does not work in sub-processes.
Anyone have any suggestions for how I might get this to work?
Thanks for any help you can give.
Andy