Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shortcut to a command line utility

Status
Not open for further replies.

bernie321

Programmer
Jan 7, 2004
477
GB
Hi

I am trying to create a shortcut to run this run this program at the commmand prompt and pass the parameters:

C:\Database\dbbackup -c"eng=datab" -y -x c:\backupdb

How can I set this up?

Thanks B
 
create a batch file with the appropriate command line instructions in it.
 
Unless it'll run in Windows, in which case just (right-click) create the shortcut, complete with switches.

Sloth is the mother of invention. Necessity is just a mother...
 
Right-click on an empty space on your desktop, New, Shortcut, and follow the instructions in the New Desktop Shortcut Wizard that will then launch.
 
Hi

I created the batch file with the exact command line instructions but it does not run the program properly - in the few seconds that the batch file flashes up it seems to be not receiving the parameters.

The program takes about 20 mins to backup the database - it does this with an on-screen counter.

I have tested the command line instructions by typing them into the command prompt and it runs fine from there.

Thanks B
 
Use the Start command:


StartStarts a separate Command Prompt window to run a specified program or command. Used without parameters, start opens a second command prompt window.

Syntax
start ["title"] [/dPath] [/i] [/min] [/max] [{/separate | /shared}] [{/low | /normal | /high | /realtime | /abovenormal | belownormal}] [/wait] [/b] [FileName] [parameters]

Parameters
"title"
Specifies the title to display in Command Prompt window title bar.
/dPath
Specifies the startup directory.
/i
Passes the Cmd.exe startup environment to the new Command Prompt window.
/min
Starts a new minimized Command Prompt window.
/max
Starts a new maximized Command Prompt window.
/separate
Starts 16-bit programs in a separate memory space.
/shared
Starts 16-bit programs in a shared memory space.
/low
Starts an application in the idle priority class.
/normal
Starts an application in the normal priority class.
/high
Starts an application in the high priority class.
/realtime
Starts an application in the realtime priority class.
/abovenormal
Starts an application in the abovenormal priority class.
/belownormal
Starts an application in the belownormal priority class.
/wait
Starts an application and waits for it to end.
/b
Starts an application without opening a new Command Prompt window. CTRL+C handling is ignored unless the application enables CTRL+C processing. Use CTRL+BREAK to interrupt the application.
FileName
Specifies the command or program to start.
parameters
Specifies parameters to pass to the command or program.
Remarks
You can run nonexecutable files through their file association by typing the name of the file as a command. For more information about creating these associations in a command script by using assoc and ftype, see Related Topics.
When you run a command that contains a the string "CMD" as the first token without an extension or path qualifier, "CMD" is replaced with the value of the COMSPEC variable. This prevents users from picking up cmd from the current directory.
When you run a 32-bit graphical user interface (GUI) application, cmd does not wait for the application to quit before returning to the command prompt. This new behavior does not occur if you run the application from a command script.
When you run a command that uses a first token that does not contain an extension, Cmd.exe uses the value of the PATHEXT environment variable to determine which extensions to look for and in what order. The default value for the PATHEXT variable is: .COM;.EXE;.BAT;.CMD (that is, the syntax is the same as the PATH variable, with semicolons separating the different elements).
When you search for an executable and there is no match on any extension, start searches directory name. If it does, start opens Explorer.exe on that path.
Examples
To start the Myapp program at the command prompt and retain use of the current Command Prompt window, type:

start myapp

 
By the way, the syntax must be:

Start "", your_batch_file

Otherwise, the name of the executitable batch is treated as a Windows title.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top