创建备份批处理文件来备份我的编程代码
刚刚阅读了其他人一直在询问的有关批处理文件的问题,但找不到任何有用的东西。
我想使用批处理文件备份所有 C# 代码。请帮我找出我做错了什么?
这就是我要求我的批处理文件运行的内容:
copy C:\Visual Studio Express\Test Programs\Program 1\ c:\Backup Code\
每次我在谷歌上找到一些代码时,它都会显示如下内容:
copy C:\Fred\*.exe g:
现在这对我来说毫无用处,正如我尝试的那样,并且该代码中没有空格,就像我的一样。
如果您能帮助我,我将不胜感激。谢谢!
Just been reading through the questions that other people have been asking about batch files, and can't find anything useful.
I am wanting to backup all of my c# code, using a batch file. Please help me to find out what I am doing wrong?
This is what I am asking my batch file to run:
copy C:\Visual Studio Express\Test Programs\Program 1\ c:\Backup Code\
Everytime I find some code on google, it shows something like this:
copy C:\Fred\*.exe g:
Now that is useless to me, as I tried that, and that code has got no spaces in, like mine does.
If you can help me out, that would be greatly appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
尝试:
也就是说,您可以在本地运行源代码控制存储库,请查看 本教程 了解有关如何设置“本地”SVN 源代码控制存储库的一些信息。这可以用作备份,并且具有为您提供备份历史记录的额外优势。
Try:
That said, you can run a source control repository locally, take a look at this tutorial for some information on how to setup a "local" SVN source control repository. This can function as a backup and has the added advantage of giving you a history of backups.
只需在文件名周围使用引号即可:(
尽管我认为您需要使用
xcopy
或复制...Program 1\*.*
才能正常工作)另外,如果您可以忍受公开,备份源代码的更好方法是使用免费的版本控制系统,例如 GitHub:
https://github.com/
他们将允许你保留您的更改历史记录,并允许您回滚到以前的版本。这在某些时候会变得非常有帮助:)
Simply use quotes around your filenames:
(though I think you'll want to use
xcopy
or copy...Program 1\*.*
for this to work properly)Also, if you can stand it being public, a much better way to back up your source code is to use a free version control system, such as GitHub:
https://github.com/
They will allow you to keep a history of your changes, and allow you to roll back to previous versions. This will become very helpful at some point :)
如果有空格,则必须将路径放在引号中:
但是,您不应该复制项目,而应该真正考虑使用源代码管理系统,例如 Subversion、GIT 或 其他内容。
You have to put your paths in quotes if you are having white spaces:
But instead of copying your project you should really consider using a source code management system like Subversion, GIT or something else.
只需引用您的路径:
我还建议您查看 xcopy 而不是复制。它允许一些更有用的操作。
Just quote your paths:
I also recommend you to check out xcopy instead of copy. It allows some more useful operations.
您可能需要将包含空格的路径用
""
括起来You problably need to wrap paths that contains spaces with
""