Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: entering username and password in the batch file  (Read 50891 times)

0 Members and 1 Guest are viewing this topic.

vishi

  • Guest
entering username and password in the batch file
« on: April 12, 2007, 10:34:39 PM »
Hi,
I am running a dxl file from my batch file as follows



CD C:\Program Files\Telelogic\DOORS 7.1\bin
doors -batch D:\programs\searchstringcmdline.dxl -user "vishi" -password "123"



What I want is
CD C:\Program Files\Telelogic\DOORS 7.1\bin
doors -batch D:\programs\searchstringcmdline.dxl -user %1" -password %2

so that I can enter the username and password of my choice
Can my batch file contain username and password which later on get substituted at both the places.

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: entering username and password in the batch file
« Reply #1 on: April 13, 2007, 05:03:07 AM »
%1 and %2 are command line arguments and must be sent to the program on the command line when the program is run. You can create (set) variables and then use them in your code.

Code: [Select]
CD C:\Program Files\Telelogic\DOORS 7.1\bin
set user=username
set pswd=password
doors -batch D:\programs\searchstringcmdline.dxl -user %user%" -password %pswd%

This creates a security breach so be careful.

Another way to do this would be to prompt for the information:

Code: [Select]
CD C:\Program Files\Telelogic\DOORS 7.1\bin
set /p user=Enter Username:
set /p pswd=Enter Password:
doors -batch D:\programs\searchstringcmdline.dxl -user %user%" -password %pswd%

Good luck.  8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

vishi

  • Guest
Re: entering username and password in the batch file
« Reply #2 on: April 16, 2007, 01:43:56 AM »
Thanx,
it worked
 :)