Solved

need help with a .bat file xcopy command

Posted on 2011-03-17
7
367 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
Synchronize a new Active Directory domain with an existing Office 365 tenant
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

911 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

22 Experts available now in Live!

Get 1:1 Help Now