reggiep Posted September 6, 2012 Posted September 6, 2012 Hi, We are running through are numerous tidy up jobs after changing our whole domain and workstation setup. I am having a real struggle trying to do the simplest of task, I think because there are so many of them! I am trying to create a boot script that will copy files from \\Dc1\netlogon\_INF\SMTRAN\_ALL to c:\windows\start this is to add any extra shortcuts to our users menu as an when they crop up. However when my script runs - COPY "\\DC1\NETLOGON\_INF\SMTRAN\_All" "C:\WINDOWS\START\" I get an error the system cannot find the file specified. Can someone tell me what I am doing wrong? Thanks
Quackers Posted September 6, 2012 Posted September 6, 2012 I could be wrong but i think batch files do not like to copy from UNC paths, when i used them in the XP days i mapped a network drive to the share first then did a net use * /delete at the end to disconnect the network drive.
mac_shinobi Posted September 6, 2012 Posted September 6, 2012 I could be wrong but i think batch files do not like to copy from UNC paths, when i used them in the XP days i mapped a network drive to the share first then did a net use * /delete at the end to disconnect the network drive. Most likely the safest method but did find this using pushd and popd : Simplify UNC usage in command line batch files | Remote Administration For Windows
reggiep Posted September 6, 2012 Author Posted September 6, 2012 I'm using Windows 7 with server 2008 R2. Thanks for all the replies so far!
FN-GM Posted September 6, 2012 Posted September 6, 2012 try this robocopy "\\DC1\NETLOGON\_INF\SMTRAN\_All" "C:\WINDOWS\START" /mir 1
reggiep Posted September 6, 2012 Author Posted September 6, 2012 As always FN, I bow down to your amazingness! That worked!
reggiep Posted September 6, 2012 Author Posted September 6, 2012 Although I may have to take back some of the praise as that currently takes anything that is in the folder and removes it! I assume the /MIR switch at the end is to blame!
kism3t Posted September 6, 2012 Posted September 6, 2012 would a vbs script do the job, something like; Set fso = CreateObject("Scripting.FileSystemObject") fso.CopyFile "\\UNC_Path\File", "Dest_File",TRUE
mac_shinobi Posted September 6, 2012 Posted September 6, 2012 (edited) would a vbs script do the job, something like; Set fso = CreateObject("Scripting.FileSystemObject") fso.CopyFile "\\UNC_Path\File", "Dest_File",TRUE Would WMI work --> one of the copy methods as per this link : Scripting Files and Folders using VBScript http://www.tek-tips.com/viewthread.cfm?qid=1143068 Edited September 6, 2012 by mac_shinobi
soveryapt Posted September 6, 2012 Posted September 6, 2012 Shortcuts, as in desktop short cuts to programs and network locations etc? If you're using 2008 R2 and W7, why not look at the User Windows Preferences and set the short cuts from within GPO .. works here for me and you can target them to different users if you need to.
FN-GM Posted September 6, 2012 Posted September 6, 2012 (edited) Although I may have to take back some of the praise as that currently takes anything that is in the folder and removes it! I assume the /MIR switch at the end is to blame! do you mean in the destination folder? /mir will make it a exact replica of the source. You can change it if you want a merge. If you want to merge use this code robocopy "\\DC1\NETLOGON\_INF\SMTRAN\_All" "C:\WINDOWS\START" /copy:d Personally i wouldnt over complicate it with a VBS script. Edited September 6, 2012 by FN-GM
reggiep Posted September 6, 2012 Author Posted September 6, 2012 I'll stick to robocopy thanks. Did the job with a /S switch.
reggiep Posted September 7, 2012 Author Posted September 7, 2012 Can I just thank all the guys who replied to this thread. Having a bad time at the moment here as there are loads of little niggles with our new system that are keeping us very busy. It's great to know that people out there are willing to help us without expecting anything in return! 1
mac_shinobi Posted September 7, 2012 Posted September 7, 2012 We do get something in return in a round about way - end up learning a few things and find other ways of doing the same thing. As FN GM stated - stick to robocopy as a script is not required and is over complicating it.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now