Giiving inputs to CMD exe by daynamically - batch-file

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?

Related

Replacing a String inside a file with a given input

I am using a program which checks a config file at every start with the given settings, I am editing a specific line inside the config file very often to find out which option is the best. I wanna add a option to my batch script which asks me for a input that I type inside the command prompt and replaces it with the current text on that line inside the file. The line inside the config file that I want to replace is called max_items: 2. I basically just wanna replace the number everytime I chose the option inside my batch script. I already heard of a text command utility called FART but I don't know if it can really help me with the script that I wanna add to my batch file bc it should ask for a input and replace it with that input. I hope someone has a Idea and can help me out

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.

Is it possible to create a batch file that will call another batch file at some point and also supply it with a sequence of inputs

I have a batch file (lets say "test.bat"). Now when we run this test.bat it asks for user inputs during it's execution, For ex. user credentials and then shows a menu. The user can choose an option from the menu by entering a value after which the script will ask him for a lot more product specific details.
Question:
I need to call this test.bat inside another batch file and whenever test.bat requires user inputs my batch script should be able to provide a some inputs (a known sequence of menu options and inputs).
Is there anyway I can achieve this?
To call another batch file, I refer this link:
Several ways to call a windows batch file from another one or from prompt. Which one in which case?
To get user inputs:
Echo off
set /p x=path name:
echo path is %x%
pause

How Do i request a user to have input inot a batch file and then add it into a command?

OK, so I've never written a batch file before, but I have now got to the point where I need a batch file but as far as I'm aware it's going to be quite complex. So, basically this is what I need to do:
I need a batch file that will ask the user a few questions and then use their answers to complete a command to be run in the cmd.exe in Windows.
The command for my machine is as follows:
csvde -f C:\output -d "cn=Users,dc=test,dc=local" -r "(&(objectClass=user)(objectCategory=person))" -l "givenName, sn, objectGUID"
So I need a batch file that would ask the customer the info to go in the fields of the "dc=test" and the "dc=local" and then execute the finished command.
Any sort of help would be excellent, Thanks in advance.
:testlp
(set test=)
set /p test="Please enter test value "
if not defined test goto testlp
then use dc=%test% rather than dc=test
Leave you to figure out how to input local all by yourself...

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