• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 12529
  • Last Modified:

Run program in Minimized Mode with BATCH file

I want to run a program with a BATCH file and have it start in Minimized mode. This is what is in the BATCH file right now.

Call "C:\Documents and Settings\USER\My Documents\Programs\Shortcut name.lnk"

I am using Call instead of Run or Start because when I use these it fails. My guess is because I have spaces in the path.

Any help is appreciated.

0
calbackup
Asked:
calbackup
1 Solution
 
Ryan_KemptCommented:
Why are you calling a shortcut and not the file the shortcut leads to? Anyways, if I understand correctly you should look up CMDOW (Commandline Window Utility) which allows you to hide windows that you execute from bash, remove them from the toolbar, among many other neat things.
0
 
MshineCommented:
Try using a "_" between Shortcut_name.lnk

Try using START instead of call...??? I am not huge on DOS but here is a link
for help.. and try the commands /MIN  (for minimized) or /S  (for Silient hidden)

Like this:
Start /Min "C:\Documents and Settings\USER\My Documents\Programs\Shortcut name.lnk"

http://www.computerhope.com/starthlp.htm
0
 
MshineCommented:
Duh... Changing the space to a _ would screw up your reference.. scratch that note.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
drbayerCommented:
Instead of trying to run a link you need to run the program directly.  The "start" command provides the functionality you're looking for.  If your path has spaces, then specify the path with the /D flag and the path in quotes.  Be careful to put /MIN before the command itself, as otherwise it might be interpreted as a parameter for the command rather than as a parameter for START.

Example:  to start Internet Explorer minimized
start /D"C:\Program Files\Internet Explorer" /MIN /B iexplore.exe

Notice there is no space between /D and the path, but there is between /B and the command.
0
 
LordWolfyCommented:
You could also use the START command with the DOS filenames and the MIN option to alleviate the problem of spaces.  And if possible run the program instead of the shortcut.  

The general rule for shortening filenames is that for anything longer than 8 chars or anything with spaces, you take the first 6 (or less if there arent that many) followed by a ~ and then a number.  This is usually 1 but if anything else matches those first 6 characters (very rarely the case) the number is taken according to alphabetical order.

Here is an example based on your code:
start c:\docume~1\user\mydocu~1\programs\program /MIN

Open in new window

0
 
LordWolfyCommented:
Sorry - thats chronological order not alphabetical
0
 
calbackupAuthor Commented:
Thank you!
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now