How to specify the current directory in Windows Shell?
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 I use 7-Zip for archiving. 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% is your current directory. Try echo %CD% in a dos prompt to try it out.
You can specify "the current directory" simply as ., for example: "C:\Program Files\7-Zip\7z.exe" a -mx9 archive.7z . -psecret -mhe=on xcopy archive.7z "G:\My Documents\My Dropbox\" /c /d /s /e /k /y It's just a more complicated case of doing something as easy as dir .
You can get the current directory path if from the script path you put this line at the top of your script file: $CurrentDirectory = Split-Path $MyInvocation.InvocationName
How to find which users logged in in the last 30 minutes UBUNTU 16.04
Fetch data from a file
Can I automate ssh connection? ssh user#server.company.com
Oozie— java: command not found - shell action
How to execute system command with an argument that contains spaces
Why the shell doesn't write the good hour and give me the year?
shell script with dynamic variable
Trying to get files from today date and result is displaying yesterday date files as well (Unix Korn Shell)
Nagios plugin that runs at 2pm daily
remove with double-asterisk wildcards does not work [duplicate]
Zero byte output File in Unix Environment
Format data using Awk Statemnt
Passing environment variables over ssh for remote expansion
Providing input for additional authentication using Plink
Way to create multiline comments in Bash?
How do you execute a SHELL script in multiple directories without having to generate a run script