-
Apr 1st, 2021, 01:00 PM
#1
Thread Starter
New Member
Help needed to automate console input
Hello,
Below is my command to perform one activity. It accepts few arguments which is fine and no issues there. But when we run that command in cmd, it asks for password and confirm password.
I want to automate that password and confirm password part. How can I do that?
Example:
When we run below command in cmd -
c:\Test\myscript.exe --arg1 --arg2 --config "c:\Temp\config.cfg" --confirm
It shows below in same command prompt-
Performing the script execution for ABCD.
Enter password:
Type again to confirm:
What I need is, How can I automate this entering of password and confirm password, considering I have the password.
Please help here. PowerShell or VBScript is preferred solution.
-
Apr 1st, 2021, 01:27 PM
#2
Re: Help needed to automate console input
What is in myscript.exe? Did you make an .exe out of a script? If so, what is in the script?
-
Apr 1st, 2021, 01:41 PM
#3
Thread Starter
New Member
Re: Help needed to automate console input
Originally Posted by jdc2000
What is in myscript.exe? Did you make an .exe out of a script? If so, what is in the script?
This is just an example I used. basically .exe is any program and we cannot modify that program since that is third party software.
-
Apr 1st, 2021, 01:44 PM
#4
Re: Help needed to automate console input
It sounds like what you are looking for is automated testing software. The links below might be useful:
https://www.guru99.com/automated-testing-tools.html
https://testguild.com/automation-testing-tools/
-
Apr 1st, 2021, 02:11 PM
#5
Thread Starter
New Member
Re: Help needed to automate console input
Originally Posted by jdc2000
Thanks. This is for automation for regular work not a testing software. I checked on internet and found this can be possible by VBscript or Powershell but not exact code. In VBScript we need to use sendkeys "{Enter}" something like that. I tried below code but still it is not working. WshShell.Run is working and it is even opening cmd and executing command but it is not entering the password.
VBScript I am using -
File::: myvbscript.vbs
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run """c:\Test\myscript.exe"" --arg1 --arg2 --config ""C:\Test\config.cfg"" --confirm", 9
WScript.Sleep 200
input = Wscript.Arguments.Item(0)
For i=LBound(1) To UBound(Len(input))
Wscript.Sleep 200
WshShell.SendKeys Mid(input, i, 1)
echo input
Next
WshShell.SendKeys "{ENTER}"
For i=LBound(1) To UBound(Len(input))
Wscript.Sleep 200
WshShell.SendKeys Mid(input, i, 1)
Next
Wscript.Sleep 200
WshShell.SendKeys "{ENTER}"
Wscript.Sleep 200
This VBScript I am calling from batch file from command prompt. Batch file contents are -
File::: mybatch.bat
SET PWD = %~1
cscript "c:\Test\myvbscript.vbs" %PWD%
and batch file I am calling from command prompt as below -
c:\Test\mybatch.bat "mypassword"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|