如何指定Windows Shell中的当前目录? [英] How to specify the current directory in Windows Shell?
问题描述
我有打算归档指定的文件夹,通过密码来保护它,并归档文件复制到我的本地文件夹的Dropbox以下BAT文件。
I have the following BAT file which is intended to archive the specified folder, protect it by a password and copy the archive file to my local Dropbox folder.
"C:\Program Files\7-Zip\7z.exe" a -mx9 archive.7z "G:\This is a test\directory\with subdirectories\" -psecret -mhe=on
xcopy "G:\This is a test\directory\with subdirectories\archive.7z" "G:\My Documents\My Dropbox\" /c /d /s /e /k /y
我使用的7-Zip进行归档。
I use 7-Zip for archiving.
是否有可能改变脚本以这样的方式,我可以把它放在我选择的任何文件夹中,它确实是相同的 - 存档当前文件夹,通过密码来保护它,并归档文件复制到我的本地的Dropbox文件夹?
Is it possible to alter the script in such a way that I can put it in any folder I choose and it does the same - archive the current folder, protect it by a password and copy the archive file to my local Dropbox folder?
简单地说,什么是归档当前目录和所有子目录命令?
Simply said, what is the command for "archive the current directory and any sub-directories"?
推荐答案
%CD%
是当前目录。尝试在DOS提示符下回声%CD%
来尝试一下。
%CD%
is your current directory. Try echo %CD%
in a dos prompt to try it out.
这篇关于如何指定Windows Shell中的当前目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!