Solved

need help with a .bat file xcopy command

Posted on 2011-03-17
7
371 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
Technology Partners: 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!

 
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
A procedure for exporting installed hotfix details of remote computers using powershell
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

635 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