![]() When the script is finished, this keyword just tells the shell to wait for you to press enter or close the command prompt instead of exiting it immediately. Otherwise you have to copy 7z.exe to the current directory or specify an absolute path to where it is located (such as, for instance, "C:\Program Files\7-zip\7z.exe". If that file isn't in the current directory (that test directory mentioned above), then it'll have to be on the PATH (in the %PATH% environment variable try echo %PATH% in a shell to see what it's set to currently). If it does nothing, it's probably because it can't find the path of 7z.exe. It's no surprise that this doesn't do what you want! It looks like this would zip the entire directory into a single. This will cause the loop "body" (the action behind the keyword DO) to get executed exactly once, with the %i parameter assigned the value C:\Users\MVD21\Desktop\test. The parameter to the IN here is (C:\Users\MVD21\Desktop\test). This is just so you can "see" what it's really doing before it does it.Ĭhanges Directory into what I hope is the path where you want to zip up all the files.įOR %%i IN (C:\Users\MVD21\Desktop\test) DO 7z.exe a "%~ni.7z" "%i" Tells the command prompt to print back each command in the batch file before executing them. Your original script does the following, line by on
0 Comments
Leave a Reply. |