views:

546

answers:

3

Hello

When i copy files to a some network path with xcopy command I get new virtual drives on my pc . The problem is that i do that within a batch script that runs in scheduler so i get there a lot of drives to same location.

How I can copy files to a network with out getting a new drives on the pc or just remove them ?

Thanks.

A: 

It sounds like the command you are using to call xcopy. Can we see that ?

eleete
i call it via batch file first i do pushd \\somepath\etcthen i do xcopy "%mycopyposition%\*.exe"
Night Walker
A: 

the net command is your fiend (as good a fiend you can get on Windows). To remove a network drive you might want to look at:

net use /?
Chen Levy
Is it possible somehow not to get all that network drives via the commands i run to get them ? i use pushd and xcopy . thanks
Night Walker
+1  A: 

Wait a minute. You're using pushd. pushd, as the documentation states:

If Command Extensions are enabled the PUSHD command accepts network paths in addition to the normal drive letter and path. If a network path is specified, PUSHD will create a temporary drive letter that points to that specified network resource and then change the current drive and directory, using the newly defined drive letter. Temporary drive letters are allocated from Z: on down, using the first unused drive letter found.

While that's perfectly fine to use, you should never call pushd without an appropriate popd afterwards.

So instead of just

pushd \\somepath\etc
xcopy "%mycopyposition%*.exe"

you add another line

popd

which will de-allocate the temporary drive letter again.

Joey