Solved

need help with a .bat file xcopy command

Posted on 2011-03-17
7
366 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
  • 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
This article will help you understand what HashTables are and how to use them in PowerShell.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now