vickerps Posted March 19, 2004 Posted March 19, 2004 How would i write this I can do it but it messy and lot of repeat coding. I am sure there a easier way FileCopy ( "D:\utility\Receipt.ini", "C:\windows\Receipt.ini", 1) FileCopy ( "D:\utility\reset.ini", "C:\windows\reset.ini", 1) FileCopy ( "D:\utility\logon.cmd", "C:\windows\logon\logon.cmd", 1) FileCopy ( "D:\utility\NtConfig.pol", "C:\windows\NtConfig.pol", 1) FileCopy ( "D:\utility\unres.pol", "C:\windows\unres.pol", 1) If any of the filecopy's fail i want the script to bring a msgbox up saying 'abort' or somthing like that and then exit
Administrators Jon Posted March 19, 2004 Administrators Posted March 19, 2004 How would i write this I can do it but it messy and lot of repeat coding. I am sure there a easier way FileCopy ( "D:\utility\Receipt.ini", "C:\windows\Receipt.ini", 1) FileCopy ( "D:\utility\reset.ini", "C:\windows\reset.ini", 1) FileCopy ( "D:\utility\logon.cmd", "C:\windows\logon\logon.cmd", 1) FileCopy ( "D:\utility\NtConfig.pol", "C:\windows\NtConfig.pol", 1) FileCopy ( "D:\utility\unres.pol", "C:\windows\unres.pol", 1) If any of the filecopy's fail i want the script to bring a msgbox up saying 'abort' or somthing like that and then exit$res = 0 $res = $res + FileCopy ( "D:\utility\Receipt.ini", "C:\windows\Receipt.ini", 1) $res = $res + FileCopy ( "D:\utility\reset.ini", "C:\windows\reset.ini", 1) $res = $res + FileCopy ( "D:\utility\logon.cmd", "C:\windows\logon\logon.cmd", 1) $res = $res + FileCopy ( "D:\utility\NtConfig.pol", "C:\windows\NtConfig.pol", 1) $res = $res + FileCopy ( "D:\utility\unres.pol", "C:\windows\unres.pol", 1) If $res <> 5 Then ... error handling code ... EndIf Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
Developers Jos Posted March 19, 2004 Developers Posted March 19, 2004 If you want to check every filecopy and stop on failure you could do it with a Function: FC( "D:\utility\Receipt.ini", "C:\windows\Receipt.ini") FC( "D:\utility\reset.ini", "C:\windows\reset.ini") FC( "D:\utility\logon.cmd", "C:\windows\logon\logon.cmd") FC( "D:\utility\NtConfig.pol", "C:\windows\NtConfig.pol") FC( "D:\utility\unres.pol", "C:\windows\unres.pol") Func FC($src,$trg) $rc = FileCopy ($src,$trg) If $rc then return MsgBox(48,"Error","Error copying file:" & $src) Exit EndFunc SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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