Jump to content

How to copy files in RunOnceEx.cmd


Recommended Posts


@sleepnmojo: Now tell the truth: did you try, or just look? If you tried, you may not have been so quick to post. It was just a favor, but if you want a lesson ... The final backslash is there for two reasons. Firstly, it is included in the failed example at the top of the page. Secondly, it tells the interpreter that you want to copy the file ABC.TXT to the D:\EFG\ABC.TXT, and not E:\EFG. Assuming the exercise is to copy ABC.TXT to another directory, the trainling backslash is required for correct syntax, and to avoid creating the file D:\EFG in the case the directory D:\EFG is non-existant.

Resulting value in the registry:

CMD /C COPY "C:\ABC\ABC.TXT" "D:\EFG\"

Link to comment
Share on other sites

@sleepnmojo: Now tell the truth: did you try, or just look? If you tried, you may not have been so quick to post. It was just a favor, but if you want a lesson ... The final backslash is there for two reasons. Firstly, it is included in the failed example at the top of the page. Secondly, it tells the interpreter that you want to copy the file ABC.TXT to the D:\EFG\ABC.TXT, and not E:\EFG. Assuming the exercise is to copy ABC.TXT to another directory, the trainling backslash is required for correct syntax, and to avoid creating the file D:\EFG in the case the directory D:\EFG is non-existant.

Resulting value in the registry:

CMD /C COPY "C:\ABC\ABC.TXT" "D:\EFG\"

I was actually referring to your \"\" at the end, but since you wanted to teach me something, I'll correct you.

If D:\EFG\ didn't exist, your command wouldn't work. You would need to use XCOPY. Copy gives an error saying it can't copy the file, thus you would have to make one. XCOPY doesn't have that limitation.

Link to comment
Share on other sites

OK, you win: you are the smarter a**! Too bad you prefer to nit pick, than to answer the question yourself ... No, it wont copy if D:\EFG\ does not exist - behaviour by design - which is the desired effect, as opposed to creating a text file named D:\EFG.

Reminds me of many of the IT meetings I went to with my Old Man. The speaker would say "Instead of re-inventing the wheel ... ", the Old Man would turn to me and say, "Tha a**hole couldn't even invent a toothpick." Or as he said upon retirement: "OK, we got the game going. Bring on the second string."

I guess I'll go back to my own corner, where nobody is interested in who has the bigger dick ...

Link to comment
Share on other sites

OK, you win: you are the smarter a**! Too bad you prefer to nit pick, than to answer the question yourself ... No, it wont copy if D:\EFG\ does not exist - behaviour by design - which is the desired effect, as opposed to creating a text file named D:\EFG.

Reminds me of many of the IT meetings I went to with my Old Man. The speaker would say "Instead of re-inventing the wheel ... ", the Old Man would turn to me and say, "Tha a**hole couldn't even invent a toothpick." Or as he said upon retirement: "OK, we got the game going. Bring on the second string."

I guess I'll go back to my own corner, where nobody is interested in who has the bigger dick ...

I only nit-pick about cmd files because I find the parser inconsistent in so many cases. Of course most of this will change in longhorn, if they give us the new shell they have been talking about.

I would join you in that corner, but the chairs are over here :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...