How to: Avoid Prompts on the Command Line
When you are using the command line, there are several methods you can use to avoid being prompted for your user name and password. The simplest method is to simply use the -Y option at the end of each command entry, if the command accepts this option. For more about this option, see -Y Option (Command Line).
Another way of avoiding prompts is to establish user login environment variables for either temporary or permanent use. You might want to use these variables if you do not wish to type your user name and password repeatedly or if you want to create and run a batch file or script that runs without user input. You can set these variables to apply to the execution of all commands, so that they can easily be used in batch operations. For more about the use of environment variables, see Setting Database Options.
Security Note |
---|
Setting login environment variables involves security compromises. Security for your database is controlled by your database administrator. Before proceeding, see your administrator for advice in avoiding command line prompts. |
To set per-session user name and password environment variables:
On your desktop, click Start, then Run.
Type "CMD", and then click OK.
Type "set ssuser=<username>", specifying your user name, and press ENTER.
Type "set sspwd=<password>", specifying your password, and press ENTER. The SSUSER and SSPWD variables are retained until the command shell user session ends. Typically, a session ends when you close the command shell.
To set persistent user name and password environment variables:
On your desktop, right-click My Computer, and then click Properties.
In the System Properties dialog box, click Advanced, and then click Environment Variables.
Under User variables for <username>, click New.
In the New User Variable dialog box, type "SSUSER" in the Variable name box.
In the Variable Value box, type your Visual SourceSafe user name (for example, Admin), and then click OK.
In the New User Variable dialog box, type "SSPWD" in the Variable name box.
In the Variable Value box, type your Visual SourceSafe password, and then click OK.