Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

DOS/Other DOS/Other
Search Search
Search for:
Tech Support Guy > > >

Shortcut thru batch file


(!)

Mark Bewick's Avatar
Mark Bewick Mark Bewick is offline
Junior Member with 21 posts.
THREAD STARTER
 
Join Date: Oct 2000
Location: Peterborough, UK
20-Oct-2000, 08:36 AM #1
Hi all,

Does anyone know how to create a shortcut through a Batch file.

To give you an idea, I am trying to create a desktop shortcut (C:\windows\desktop) to an .exe file

Thanks in advance

------------------
Mark Bewick
RandyG's Avatar
RandyG   (Randy) RandyG is offline RandyG has a Profile Picture
Member with 7,760 posts.
 
Join Date: Jun 2000
Location: American living in Dublin, Ire
Experience: Advanced
20-Oct-2000, 12:22 PM #2
Hi Mark,

Usually you would run a Batch file in DOS. The windows icons that are on your desktop make it easier to do.

What OS are you using?

In DOS, Type "edit ???.bat"(without the quotes) where ??? is the name of your batch file. In the first line of your MS DOS Editor, you would type in the directory you wanted to target (c:\windows\desktop\). The next line would look like "***.exe""(without the quotes) where *** is the name of the program you want to open.

If you do this in the C: directory, and that is what you open up to upon starting your system, then you will only need to type in the ??? of the batch file to open that program. You can even include the Batch file name to the end of your Autoexec.bat to have the system automatically start that program after boot up.

Hope this helps.

[This message has been edited by RandyG (edited 10-20-2000).]
Mark Bewick's Avatar
Mark Bewick Mark Bewick is offline
Junior Member with 21 posts.
THREAD STARTER
 
Join Date: Oct 2000
Location: Peterborough, UK
23-Oct-2000, 04:15 AM #3
Thanks for your reply.

I am using Windows 2000 Pro, but writing a batch file to be used on Windows 95 and NT 4.0 Wstation.

I have written a batch file which reads the following to open an executable:

Copy C:\rio32\toolbar.exe c:\windows\desktop\rio.exe

However as this .exe file has Powerbuilder file dependancies, I just wanted to create a shortcut to this file as this would enable the path statements in the autoexec.bat to be correct, without modifications.

Cheers

------------------
Mark Bewick
mole's Avatar
mole mole is offline   mole has a birthday soon!
Member with 781 posts.
 
Join Date: Aug 1999
Location: Indian Head, MD
Experience: Advanced
23-Oct-2000, 06:37 AM #4
Mark,

When working from the command prompt in a DOS session in Windows, you can create a shortcut with a copy of the old Pifedit.exe from Windows3.x. Place a copy of Pifedit in your path, then from the directory you want to create the *.pif in, type "Pifedit", enter in the appropriate information and choose SaveAs. Any *.pif can be started from a batchfile or the command prompt in Windows 9x or NT by using the string: "Start myfile.pif".

If you can not find a copy of Pifedit, you can still create a *.pif from Explorer, and call that *.pif from any batch file.

In Windows 9x, Start.exe is an executable in c:\windows\command and in WinNT, Start is an extension of the command processor. There are switches to maximize, minimize or suspend rpocessing until the application finishes. To get help for Start, type "start /?" at the command prompt.

If you want to push-down a desktop shortcut to a number of Windows 9x workstations, as in from a LAN, you could store the *.pif on a LAN drive and copy to c:\windows\desktop on each workstation.

Generally, Win9x and NT support a wide range of batch file commands. Win2k appears somewhat limited based on the short time I've tested it, but this may be a false impression.

Hope that helps,

mole
Mark Bewick's Avatar
Mark Bewick Mark Bewick is offline
Junior Member with 21 posts.
THREAD STARTER
 
Join Date: Oct 2000
Location: Peterborough, UK
23-Oct-2000, 06:49 AM #5
Mole,

Thanks for your response.

So, if I wanted to created a shortcut on the desktop (C:\windows\desktop) to a file called toolbar.exe in the c:\rio32 folder, what would the statement read in the batch file.

Would I first have to create a toolbar.pif in the rio32 directory then create a shortcut to this?

Thanks again for your response.




------------------
Mark Bewick
mole's Avatar
mole mole is offline   mole has a birthday soon!
Member with 781 posts.
 
Join Date: Aug 1999
Location: Indian Head, MD
Experience: Advanced
23-Oct-2000, 07:14 AM #6
Mark,

To start a program, toolbar.exe from a desktop shortcut, you could take the standard route and right click the Desktop > New > Shortcut > (Enter in the appropriate file info, as in this case, c:\rio32\toolbar.exe). You might save this as ToolBar, in which case the link would have the address c:\windows\desktop\toolbar.lnk

Once you create this, it can be started from a batch file if you want with the following:

start c:\windows\desktop\toolbar.lnk

You could also create a shortcut on the desktop to a batchfile located elsewhere on the PC (c:\bat\toolbar.bat for example), in this case the desktop link (actually a *.pif, which might be named ToolBar.pif). The batchfile in this case, would have the line:

start c:\rio32\toolbar.exe


The latter is very powerful on LANs where you might want to some time in the future, change the location of \rio32\toolbar.exe.

Running Windows with batchfiles is very useful over a LAN, but it can take trial and error and a lot of tinkering to get everything to work smoothly. Be careful working with mixed fleets where you have Windows 9x, WinNT and Win2k as each is a bit different.

mole
Mark Bewick's Avatar
Mark Bewick Mark Bewick is offline
Junior Member with 21 posts.
THREAD STARTER
 
Join Date: Oct 2000
Location: Peterborough, UK
23-Oct-2000, 08:48 AM #7
Mole,

Thanks again for your reply.

What I need is for the batch file to create the shortcut for me - sorry, I don't think I was very clear in my previous messgages. This will save me visiting each client to make the shortuct, i.e. I want to be lazy and automate the whole thing! ;-)

Thanks and best regards

------------------
Mark Bewick
mole's Avatar
mole mole is offline   mole has a birthday soon!
Member with 781 posts.
 
Join Date: Aug 1999
Location: Indian Head, MD
Experience: Advanced
23-Oct-2000, 09:37 AM #8
Mark,

If you are working with networked PCs, you can copy the *.lnk to each desktop from a central location on the LAN. That is the simplest way to do things.

If you want to distribute a link to user's desktops by building one with a DOS batchfile run on each individual machine, here is an example of how to create a link to open Notepad.exe, which should work for your program "Toolbar.exe" if you make the appropriate substitutions:


echo [InternetShortcut] > c\:windows\desktop\Notepad.url

echo URL=c:\windows\notepad.exe >> c\:windows\desktop\Notepad.url

echo IconIndex=1 >> c\:windows\desktop\Notepad.url

echo IconFile=c:\windows\notepad.exe >> c\:windows\desktop\Notepad.url


Be very careful with line wrapping here. I put carriage returns between lines so you might better see what text goes on the same line. This method creates a *.url that is plain text and points not to the internet, but to a file on your local PC. In this example Notepad.exe. All we do is "echo" the string and redirect with the > and >> to a file, in this case, I named the file Notepad.url which will show up on the Windows 9x desktop as "Notepad". The > starts the file new, >> appends to the file already there.

Also note that the "Desktop" will be located in a different path on WinNT and Win2k. If you have other than standard installs of Win9x (installed to the c:\windows directory) your "Desktop" may be in yet another location.

If you have more questions or need more help, let me know.

mole
Mark Bewick's Avatar
Mark Bewick Mark Bewick is offline
Junior Member with 21 posts.
THREAD STARTER
 
Join Date: Oct 2000
Location: Peterborough, UK
23-Oct-2000, 09:54 AM #9
Thanks you very very much. This has worked a treat.



------------------
Mark Bewick
mole's Avatar
mole mole is offline   mole has a birthday soon!
Member with 781 posts.
 
Join Date: Aug 1999
Location: Indian Head, MD
Experience: Advanced
23-Oct-2000, 10:03 AM #10
Mark,

Glad that's what you needed. Many things Windows does through the graphical user interface (GUI) can be done with batch files. Sometimes you have to cheat and do it with the GUI first, then go and replicate it with a batchfile once you see how it goes.

mole
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑