xcopy in vista not copying the files

S

Santel

Hi,

I have a batch file to copy some files with xcopy command.

xcopy "E:\Test\*" "C:\Program Files\Test1\" /q /y

In WindowsXP it is working fine, but in vista it is not copying due to
permission. Anyone please suggest me if there are any commands we have
to include to give the permission setting.
 
A

Andrew McLaren

Santel said:
I have a batch file to copy some files with xcopy command.
xcopy "E:\Test\*" "C:\Program Files\Test1\" /q /y
In WindowsXP it is working fine, but in vista it is not copying due to
permission. Anyone please suggest me if there are any commands we have

Hi Santel

That is normal behaviour in Vista. The directory tree under "Program Files"
is protected, so that you cannot write files there without the Administrator
privilege. This is to prevent viruses and trojans hijacking your program
files.

Even if you are logged in as the Administrator, you still need to explicitly
run the batch file "as administrator" to write to these directories.
Right-click the batch file and choose "Run as Administrator" from the
context menu. Or, open a Command Prompt by right-clicking the Command Prompt
icon and choosing "Run as Administrator" and then run the batchfile from
this administrative command prompt.

The other alternative is to grant write permissions to your user context,
for the "C:\Program Files\Test1" directory - if you're happy to have files
written to this location. Right-click the "C:\Program Files\Test1" directory
in Explorer, choose Properties, Security, and use the ACL editor to grant
the necessary permissions to your user for that directory.

Hope it helps,
Andrew
 
M

Michael Walraven

C:\Program Files\ is a protected system area. It is not to be used for
'user' manipulation. Installation of programs into this area is done by the
'Trusted Installer' account. In order to allow a user to write to this
protected location you will have to bypass built in security features of
Vista.

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top