0

I'm looking for a bit of help with a windows script or DOS batch file.

I'm sure it's quite simple but I'm not sure where to start.

What I'm, looking to do is take a csv file that has two columns, "Username","Password".

It will then take the password column, run it through a program called encrypt_pwd.exe then output the result of the file which is just a string to a new file called encryptedPassword.csv that is has "username","encrypted password".

An example of the file will simply be:

Phil,test
John,test2
Andy,test

Any help would be greatly appreciated.

Thanks,

Phil

1
  • can you show a few lines of your csv file including the column names? Commented Sep 8, 2014 at 9:55

1 Answer 1

1

try this:

@echo off
echo "Username","Password" > encryptedPassword.csv
for /f "tokens=1,2 delims=,; skip=1" %%i in (%1) do (
        for /f %%x in ('encrypt_pwd.exe %%j') do (echo %%i,%%x) >> encryptedPassword.csv
)
Sign up to request clarification or add additional context in comments.

2 Comments

+1 , but you can use "skip=1" in outer FOR options instead of IF condition.
modified it to this:@echo off set _Inputfile=c:\Heritage\test.csv echo "Username","Password" > encryptedPassword.csv for /f "tokens=1,2 delims=,; skip=1" %%i in (%_Inputfile%) do ( for /f %%x in ('encrypt_pwd.exe %%j') do (echo %%i,%%x) >> encryptedPassword.csv ) and works perfecty

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.