PDA

View Full Version : DOS batch to cpy files to a prgm fldr at lgin to whch a usr has no write permission


shash_bro
10-15-2009, 03:30 PM
It's a Windows 2003 domain, and regular users don't have write
permissions to program folders. We have certain batch files on the
server used to map network drives which run when user logs in. In
active directory these batch files are specified on User->properties-

>profile tab. I have included this cmd in a batch file 'xcopy s:\xyz\*.nfo files c:


\program files\xyz /D /Y', where S: is the network drive, latest files
are copied from S: to C:, and this command fails when normal users
login because they don't have write permissions to the c:\program files
\xyz folder.

Can we switch user just to run that copy command ... something like
runas or switch user cmd. I tried runas but it prompts for password
which obviously a normal user cannot know and doesn't have to enter.
Is there any other way to do this ... I'm sure there is? Please help.

Paul Komski
10-16-2009, 01:01 AM
Maybe I haven't fully understood but if a folder is write protected for a particular user then I don't see any other way to write anything to the folder than to remove the read only restriction.

agenlu
10-22-2009, 07:50 AM
You can psexec in your batch program putting there the password you want to run the program.

psexec \\localhost -u user -p password xcopy source destination

Then use a program that convert that bat into a exe program so no one can see it. For example:

http://download.cnet.com/Bat-To-Exe-Converter/3000-2069_4-10555897.html

This programms even encript your batch file.