| 1. |
Solve : variables in FOR command? |
|
Answer» When using the for command in a batch, Look at the help for FOR Excellent answer. Technically, ~n gets the name, ~x gets the extension (which includes the dot). In the filename "Datalist.txt", Datalist is the name, and .txt is the extension. Hi Thanks very much for your quick reply. I now have this: for /r %%g in (*.*) do ( echo %pass%|gpg --batch -q --passphrase-fd 0 -o "D:\gpgD\%%~pnxg" --decrypt "%%g" ) I want to recreate the file structure (using %%~pnxg) but in an existing directory D:\gpgD This seems to work except for the fact it tries to write to the directory with double forward slashes e.g. D:\\gpgD\\dir1\\file.gpg Argh! Thank you for your patience Quote from: impaled on January 05, 2010, 08:25:22 AM
... and this is a problem? Sorry, you're right. \\ doesn't matter Misdiagnosed the problem --- GPG won't output to a directory that doesn't yet exist (it won't create them itself, for some reason.) I have solved it like this: output them in the current dir without the .gpg extensions, then robocopy out EXCLUDING .gpg extensions.... for /r %%g in (*.*) do ( echo %pass%|gpg --batch -q --passphrase-fd 0 -o "D:\gpgD\%%~dpng" --decrypt "%%g" ) Thanks all for your help.Quote "D:\gpgD\%%~dpng" That's going to give you a very strange looking path... More mistakes, on a roll today. -o "%%~dpng" Thanks! |
|