Solved

need help with a .bat file xcopy command

Posted on 2011-03-17
7
370 Views
Last Modified: 2012-05-11
I know I missing something simple here. This is what Im attempting to do.

I need to copy a file into mutilple users profiles on a citrix server and for some reason I cant get it to work. here is an example

xcopy "F:\Software\deployment.properties" "C:\Documents and Settings\%userprofile%\Application Data\Sun\Java\Deployment"

What is wrong with the command?

0
Comment
Question by:bankadmin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 3

Expert Comment

by:dtrance
ID: 35159547
Try
xcopy "F:\Software\deployment.properties" "C:\Documents and Settings\"%userprofile%"\Application Data\Sun\Java\Deployment"
0
 

Author Comment

by:bankadmin
ID: 35159622
I got a invalid parameters error.. Also I used the exact command but specified a specific user instead of %userprofile% and it worked. So I know there are no mistakes in my paths
0
 

Author Comment

by:bankadmin
ID: 35160107
I did a little more testing and I removed the docs and settings from the destination and it didnt error out but it just defaulted to the users I was running it with. i need it to copy to all users
0
Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

 
LVL 12

Accepted Solution

by:
prashanthd earned 500 total points
ID: 35163985
Hi,

You can try the following vbscript.

regards
Prashanth
On Error Resume Next

Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\Documents and Settings\"

Set objFolder = objFSO.GetFolder(objStartFolder)
Wscript.Echo objFolder.Path
Set objsub = objFolder.SubFolders
For Each sf in objsub
	desdir=sf.Path & "\Application Data\Sun\Java\Deployment"
	WScript.Echo desdir
    objfso.CopyFile "F:\Software\deployment.properties",desdir
Next

Open in new window

0
 
LVL 12

Expert Comment

by:prashanthd
ID: 35164009
Missed something, change line no 10 to following and try

desdir=sf.Path & "\Application Data\Sun\Java\Deployment\"
0
 

Author Comment

by:bankadmin
ID: 35164990
THat worked. I had to click ok for each user but it worked..

THanks
0
 
LVL 12

Expert Comment

by:prashanthd
ID: 35165294
If you run from command prompt using cscript file.vbs, it will not pop up message to click.

Thanks for the points.

regards
Prashanth
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question