buzz44 Posted January 5, 2005 Share Posted January 5, 2005 hello, me again , iv got $file = "c:\program files\microsoft games\halo" Run('xcopy /e /h $file C:\temp', "", @SW_HIDE ) it doesnt seem to work, i think its the quoution marks, this works however. Run('xcopy /e /h "c:\program files\microsoft games\halo" C:\temp', "", @SW_HIDE ) any help, id like to have it as a variable so i can change the file/directory, ty qq Link to comment Share on other sites More sharing options...
SlimShady Posted January 5, 2005 Share Posted January 5, 2005 Noobie just kiddin Here's how you should do it. (In order from good way to best way.) Run('xcopy /e /h ' & $file & ' C:\temp', "", @SW_HIDE ) Run(@ComSpec & ' /c xcopy /e /h ' & $file & ' C:\temp', "", @SW_HIDE ) RunWait(@ComSpec & ' /c xcopy /e /h ' & $file & ' C:\temp', "", @SW_HIDE ) Link to comment Share on other sites More sharing options...
buzz44 Posted January 5, 2005 Author Share Posted January 5, 2005 Noobie just kiddin Here's how you should do it.(In order from good way to best way.)Run('xcopy /e /h ' & $file & ' C:\temp', "", @SW_HIDE ) Run(@ComSpec & ' /c xcopy /e /h ' & $file & ' C:\temp', "", @SW_HIDE ) RunWait(@ComSpec & ' /c xcopy /e /h ' & $file & ' C:\temp', "", @SW_HIDE )<{POST_SNAPBACK}>i just tryed all 3 ways and none worked lol qq Link to comment Share on other sites More sharing options...
SlimShady Posted January 5, 2005 Share Posted January 5, 2005 (edited) Well, then use FileCopy. Edit: BTW, you have to add quotation marks if you specify a path with spaces. Run('xcopy /e /h "' & $file & '" C:\temp', "", @SW_HIDE ) Run(@ComSpec & ' /c xcopy /e /h "' & $file & '" C:\temp', "", @SW_HIDE ) RunWait(@ComSpec & ' /c xcopy /e /h "' & $file & '" C:\temp', "", @SW_HIDE ) Edited January 5, 2005 by SlimShady Link to comment Share on other sites More sharing options...
buzz44 Posted January 5, 2005 Author Share Posted January 5, 2005 Well, then use FileCopy.<{POST_SNAPBACK}>for wat im tryin to do i cant, need to run something while the file is copying, using filecopy waits till its finiched copying hen does it, i have to call an external prog like xcopy and do it, thanks for help qq Link to comment Share on other sites More sharing options...
SlimShady Posted January 5, 2005 Share Posted January 5, 2005 Oh. I see. I don't know the switches of XCOPY. I bet you'll figure it out. Link to comment Share on other sites More sharing options...
jacky_ckw Posted January 5, 2005 Share Posted January 5, 2005 hi, i think u need to put the \ at the end of the destination folder... from the code SlimShady provided... Run('xcopy /e /h ' & $file & ' C:\temp', "", @SW_HIDE ) Run(@ComSpec & ' /c xcopy /e /h ' & $file & ' C:\temp', "", @SW_HIDE ) RunWait(@ComSpec & ' /c xcopy /e /h ' & $file & ' C:\temp', "", @SW_HIDE ) this should be correct, hope i am not wrong... Run('xcopy /e /h ' & $file & ' C:\temp\', "", @SW_HIDE ) Run(@ComSpec & ' /c xcopy /e /h ' & $file & ' C:\temp\', "", @SW_HIDE ) RunWait(@ComSpec & ' /c xcopy /e /h ' & $file & ' C:\temp\', "", @SW_HIDE ) New to script...But getting the hang of it. Link to comment Share on other sites More sharing options...
buzz44 Posted January 5, 2005 Author Share Posted January 5, 2005 damn none of them work , the only one that i know does work is the one im using. Run('xcopy /e /h "c:\program files\microsoft games\halo" C:\temp', "", @SW_HIDE ) but doesnt use a variable, its annyong cause if i wanna compile this i wont be able to change it , i wanna make the variable a input box, maybe u just cant use variables qq Link to comment Share on other sites More sharing options...
ioliver Posted January 5, 2005 Share Posted January 5, 2005 You should be able to use a variable. Can you post the rest of your code? Maybe, you are setting up the variable incorrectly. Thanks, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
buzz44 Posted January 5, 2005 Author Share Posted January 5, 2005 expandcollapse popup$origdirect = "c:\program files\microsoft games\halo" $copydirect = "C:\temp" $file = FileExists ("C:\temp") If $file = 1 then If msgbox(1, "Confirmation", "The directory already exists. Are you sure you want to replace it?") = 2 then Exit Else CopyFolder() EndIf EndIf If $file = 0 then If msgbox(1, "Confirmation", "The specified directory doesnt exist. Would you like to create it?") = 1 then DirCreate ($copydirect) CopyFolder() Else Exit EndIf EndIf Func CopyFolder() Run('xcopy /e /h "c:\program files\microsoft games\halo" C:\temp', "", @SW_HIDE ) ProgressOn("Progress Meter", "") Do $origfilesize = dirGetSize($origdirect) $copyfilesize = dirGetSize($copydirect) $MB = dirGetSize($copydirect) / 1024 / 1024 $percent = $copyfilesize / $origfilesize * 100 $decimalplace = Round ($percent) $decimalplaceMB = Round ($MB) ProgressSet ($percent, $decimalplace & " % " & "(" & $decimalplaceMB & ") Mb has been copied.") Until $copyfilesize = $origfilesize ProgressOff () If $copyfilesize = $origfilesize then Msgbox(0,"Complete", "All files and folders have been copied successfully.") Else Msgbox(0,"Error", "1 or more of the files/folders did not copy correctly.") EndIf EndFunc ive also posted this in scripts and scraps under "Progress Bar", i just used halo and c:\temp to test it, you can change the directories and test yourself qq Link to comment Share on other sites More sharing options...
SlimShady Posted January 5, 2005 Share Posted January 5, 2005 (edited) I see the problem. I'll try to fix it. Hold on... Edit: I used the AutoIt folder for testing. expandcollapse popup;$origdirect = "c:\program files\microsoft games\halo" $origdirect = "C:\Program Files\AutoIt3" $copydirect = "C:\temp" If FileExists ($copydirect) then If msgbox(1, "Confirmation", "The directory already exists. _ Are you sure you want to replace it?") = 2 Then Exit ;Else CopyFolder($origdirect, $copydirect) Else If msgbox(1, "Confirmation", "The specified directory _ doesnt exist. Would you like to create it?") = 1 then DirCreate ($copydirect) CopyFolder($origdirect, $copydirect) Else Exit EndIf EndIf Func CopyFolder($Folder1, $Folder2) Local $ProcID $ProcID = Run(@ComSpec & ' /c xcopy /e /h /y "' & $Folder1 & '" "' & $Folder2 & '"', "", @SW_HIDE) ProgressOn("Progress Meter", "") $origfilesize = DirGetSize($Folder1) Do $copyfilesize = DirGetSize($Folder2) $MB = dirGetSize($Folder2) / 1024 / 1024 $percent = $copyfilesize / $origfilesize * 100 $decimalplace = Round ($percent) $decimalplaceMB = Round ($MB) ProgressSet ($percent, $decimalplace & " % " & "(" & _ $decimalplaceMB & ") Mb has been copied.") Sleep(500) Until NOT ProcessExists($ProcID) ProgressOff () $copyfilesize = DirGetSize($Folder2) If $origfilesize = $copyfilesize then Msgbox(0,"Complete", "All files and folders have been copied successfully.") Else Msgbox(0,"Error", "1 or more of the files/folders did not copy correctly.") EndIf EndFunc Edited January 5, 2005 by SlimShady Link to comment Share on other sites More sharing options...
buzz44 Posted January 5, 2005 Author Share Posted January 5, 2005 thanks a bunch slim , now i can add an input box or even better FileSelectFolder thanks all for help qq Link to comment Share on other sites More sharing options...
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