Solved

Create Shortcut with passed parameter

Posted on 2002-06-11
2
339 Views
Last Modified: 2012-06-27
I need to create a shortcut that passes a command line parameter to my app.  I can create the shortcut no problem, but when I try to pass the parameter, here's what I get for the target:

"C:\Program Files\ZipFiler\ZipFiler.exe Parameter"

but I need:

"C:\Program Files\ZipFiler\ZipFiler.exe" Parameter

Here's the code:

Set lnkShortcut = wshShell.CreateShortcut(sPath & "ZipFiler.lnk")

With lnkShortcut
   .Description = "ZipFiler"
   .TargetPath = sPath & "ZipFiler.exe " & sParameter
   .WorkingDirectory = sPath
   .IconLocation = sPath & "ZipFiler.ico"
   .Save
End With
0
Comment
Question by:northeyk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 4

Accepted Solution

by:
Monchanger earned 100 total points
ID: 7069859
Try adding this line inside the With statement:

.Arguments = sParameter

It works for me when creating shortcuts VBScript, so I guess that it should work as well.

If not, try this:

.TargetPath = """" & sPath & "ZipFiler.exe """ & sParameter

which is the correct syntax for a shortcut's Target Path including an argument.
0
 
LVL 4

Expert Comment

by:Monchanger
ID: 7069867
Oops - add a space between Zipfilter.exe and sParameter
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month6 days, 22 hours left to enroll

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question