• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 378
  • Last Modified:

need help with a .bat file xcopy command

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
bankadmin
Asked:
bankadmin
  • 3
  • 3
1 Solution
 
dtranceCommented:
Try
xcopy "F:\Software\deployment.properties" "C:\Documents and Settings\"%userprofile%"\Application Data\Sun\Java\Deployment"
0
 
bankadminAuthor Commented:
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
 
bankadminAuthor Commented:
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
Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!

 
prashanthdCommented:
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
 
prashanthdCommented:
Missed something, change line no 10 to following and try

desdir=sf.Path & "\Application Data\Sun\Java\Deployment\"
0
 
bankadminAuthor Commented:
THat worked. I had to click ok for each user but it worked..

THanks
0
 
prashanthdCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Protect Your Employees from Wi-Fi Threats

As Wi-Fi growth and popularity continues to climb, not everyone understands the risks that come with connecting to public Wi-Fi or even offering Wi-Fi to employees, visitors and guests. Download the resource kit to make sure your safe wherever business takes you!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now