Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hey,
I need a script to use the following command on all files in a directory:
The script sets all the files in the directory into a variable and applies the following command to all of them (each file individually):
bfish /i:%filename% /o:%filename%_encrypt /p:%password% /e
I know how to set data to variables, however, I'm not sure how to apply a command to all files in a directory simultaneously.
The script will hopefully look something like this:
Directory? enter directory here
Password? enter encryption password hereScript then continues to apply the command to all files in the directory that it has found
Any help MUCH appreciated.

The following script should work as you want; it requires Windows NT/2K/XP environments:
@Echo Off
Echo ENCR - Encryption Utility
Set Fldr=
Set Pswd=:INIT
Echo.
Set /P Fldr=Enter Folder:
If %Fldr%.==. GoTo MSG
If not exist %Fldr%.\Nul GoTo MSG
GoTo EXEC:MSG
Echo.
Echo Folder [%Fldr%] missing or not found
GoTo INIT:EXEC
Set /P Pswd=Enter Password:
Echo.
Echo Folder is [%Fldr%]
Echo Encryption Password is [%Pswd%]
Echo.
Echo Press any key to process or Ctrl+C to end
Pause > NulFor %%I in (%Fldr%.\*.*) Do (
Echo Encripting %%I
bfish /i:%%I /o:%%I_encrypt /p:%Pswd% /e
)
Echo.
Echo Processing completed
Set Fldr=
Set Pswd=Have a nice day

C:\doswork>test
ENCR - Encryption UtilityEnter Folder: c:\doswork\texts
Enter Password: paxbucuuileFolder is [c:\doswork\texts]
Encryption Password is [paxbucuuile]Press any key to process or Ctrl+C to end
Encripting c:\doswork\texts.\April 2003.txt
Error: Unable to open the input file
Encripting c:\doswork\texts.\August 2003.txt
Error: Unable to open the input file
Encripting c:\doswork\texts.\July 2003.txt
Error: Unable to open the input fileProcessing completed

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |