Batch commands to open password protected excel file

Joined
Oct 4, 2019
Messages
20
Reaction score
0
I'd like to speed up the process of opening several programs among which there is a password protected excel file, this is the line I'd use to open the excel file/program in the batch file:

start /D "C:\Users\Name\Desktop\Folder" excelfile.xlsx

that command opens excel and the file but the most important part is missing: what command is there to input the password for the file?
 
Joined
Sep 26, 2017
Messages
3,439
Reaction score
614
The files I've had to work with would pop up a dialog box that required having the password typed in it so the file would open. There would have to be something in a script that would autotype in that box, don't know if that is doable.
 
Joined
Oct 4, 2019
Messages
20
Reaction score
0
yes that's right, this works for webpages:

rem Use %SendKeys% to send keys to the keyboard buffer
set SendKeys=CScript //nologo //E:JScript "%~F0"
START FIREFOX "https://www.website.com/login"
%SendKeys% "{USERNAME}"
%SendKeys% "{TAB}"
%SendKeys% "{PASSWORD}"
%SendKeys% "{ENTER}"

goto :EOF

@end
// JScript section

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));
Share
------

I tried it for excel but it doesn't seem to work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top