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 noteSecurity 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:

  1. On your desktop, click Start, then Run.

  2. Type "CMD", and then click OK.

  3. Type "set ssuser=<username>", specifying your user name, and press ENTER.

  4. 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:

  1. On your desktop, right-click My Computer, and then click Properties.

  2. In the System Properties dialog box, click Advanced, and then click Environment Variables.

  3. Under User variables for <username>, click New.

  4. In the New User Variable dialog box, type "SSUSER" in the Variable name box.

  5. In the Variable Value box, type your Visual SourceSafe user name (for example, Admin), and then click OK.

  6. In the New User Variable dialog box, type "SSPWD" in the Variable name box.

  7. In the Variable Value box, type your Visual SourceSafe password, and then click OK.

See Also

Reference

-Y Option (Command Line)

Concepts

Setting Database Options

Other Resources

Command Line Reference