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