Insert password with a batch file - batch-file

I want to list all of my bitwarden items in a batch file. The cli command is bw list items but after this the command line asks me about the master password: ? Master password: [hidden]
So my question is, how do i write the password in a batch file, so that i don't have to rewrite my password over and over again.
And before someone mentions the security issues, i will not put the password in plain text in the batch file.
My batch file:
#echo off
bw list items
But as already mentioned after executing this batch file, the command line asks me after the master password, and i want a batch command that writes the password for me, so that only the output will be shown in the console.

Related

How can use sendKey method in bat file?

first of all, I knew this question is duplicated but I'm new to bat file and I don't know how to develop this structure.
I want a bat file that works with windows task schedule at a specific time automatically.
I manually use this command in cmd
php\php.exe -f processmaker workspace-backup workflow
then I press enter in cmd to run this command
after that
I manually use this command in cmd
SET PATH=C:\Program Files\MySQL\MySQL server 5.6\bin
then I press enter in cmd again...
ok I want a solution to pressing "ENTER KEY" automatically between these commands.
Can you please help me?
If you edit a text file and name it, say mytask.bat
All the lines in it are executed as if in the command line, so try it, it should work.

Writing secure batch files

I have a simple batch file:
#echo off
set username=user
set password=pass
::do some things with the username and password
the user could just call the batch file from cmd, and type set after my batch file has run it's course and see the username and password.
Is there any way to fix this?
(excluding bat to exe converters)
Prompt for password then save it
This script here to use the password associated with a batch file from a hidden stream attached to the file, prompt for the password if not present and save it. If you know how to work out what is going on in the batch you could do the same and get the password to work with, but to a casual observer it is not at all obvious how it works.
Password entry obscured from batch file
Script to prompt for and enter password in hidden manner.
Password hidden using ADS
Script to store password in an extra data stream with the batch file that you can't see but is there and can be read by the batch file itself.

Giiving inputs to CMD exe by daynamically

I have an application ,i want to run on using task scheduler .
now i want to set up execution through command line arguments on my local system.
i created set up but ask password i need to enter that password dynamically i.e from file are as arguments etc.
Please suggest me any solutions to skip password option or to enter password dynamically.
Does this answer your question? It explains how to call a batch file with command line parameters.
How do I pass command line parameters to a batch file?

auto schedule upload using batch file and command prompt

I am trying to use a cmd file to run a batch file that uploads a file of mine to a directory of my website. The batch file looks like this:
open ip address
username
password
option confirm off
cd \public_html\wp-content\uploads\2014\07
put "C:\Users\a\Documents\pdf\Contact Info.pdf"
quit
The cmd file looks like this:
ftp -s:c:\Users\a\Documents\upload.bat
When I run the cmd file I get output in command prompt that says that my username and password are ok and then tells me that option confirm off is an invalid command and that the cd filepath is a prohibited file name. It then says my file is uploaded but I can't find where the file is put. Is there a reason why this is happening? Is it possible to upload the file to that directory?
Use winscp. Download: http://winscp.net/eng/download.php
option confirm off is a valid WinSCP command, see http://winscp.net/eng/docs/scriptcommand_option
Example: Uploading a single file with WinSCP
http://winscp.net/eng/docs/script_upload_single_file
Step 1
create file: winscp-upload-script.txt
option batch abort
option confirm off
open sftp://username:password#example.com/
put "C:\Users\a\Documents\pdf\Contact Info.pdf" \public_html\wp-content\uploads\2014\07
exit
Step 2
create file: do-upload.bat
"C:\Program Files (x86)\WinSCP\winscp.com" /script=winscp-upload-script.txt
Step 3
Go scheduler, create new task, like described here (http://www.sevenforums.com/tutorials/12444-task-scheduler-create-new-task.html) and use do-upload.bat and configure event timing.
-Done-

BAT script - how to automatically insert additional arguments?

I want to write a simple bat script but I cannot deal with one thing.
I run a command and it gives few messages and it's waiting for my login. I want to write a script which will do it.
For example, I run a command:
myCommand.bat
and it gives:
msg1...
msg2...
...
type your login:_
Now, I have to put my login.
How can I do it automatically?
BAT script is the best way for me :)
You probably can solve this by either
placing your username and/or password directly in myCommand.bat
placing your username and/or password in a file "myPassword.txt" and using redirection: <myPassowrd.txt myCommand.bat
But, you probably should not do either of those for security reasons.
Addendum:
If your batch script is calling an executable that is prompting for the login credentials, you may have 2 options
The executable may have a command line option(s) that allows you to specify username
and/or password. You would have to research your executable to find out what they are.
If the executable is not expecting any other input, you might be able to pipe the username and/or password into the program. For example, if the program asks for username and then asks for password, something like this might work:
(echo yourName&echo yourPassword)|yourProgram.exe
Security concerns still apply

Resources