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
Close all open X-windows with a command in UNIX
How to search for a pattern having the special characters in awk
Stdout race condition between script and subscript
How to read sorted files using cat in shell script
Get data from multiple input file and write to another 1 file
compare 2 files in unix by key column
Searching a pattern in linux
how to parse string in to two values in shell script
Does the -?* pattern provide any advantage over -* for matching unknown command line option?
Grep IP address from variable containing file contents outside the if statement
Shell command to grep value for a key from a file
Shell script file takes partial path from parameter file
How to read file names from a txt file in cmd prompt(script) and then combine a subset of the files into a PDF file using the cmd line in windows
Creating Exclude user list for permissions- Unix
“no space” error when using shell script with ulimit stack at 32K
What is the difference between an OS and a shell?