Solved

NEWBIE: How to update a Scheduled Task with new path?

Posted on 2006-06-16
5
425 Views
Last Modified: 2013-12-28
Dear Experts,

We've been using InstallShield to install our product at customer sites.  Previously, we'd insisted on a hard-coded location.  Now we'll be letting them pick.

We ship a Scheduled Task with the product, which contains both:

Run:  (a btach job, with full path)

and

Start In: (the working directory, with same full path)

Before, we could hard-code that full path.  Now we need to change it either during or immediately after the install.

Is there a fairly simple way to do this?  (We're pretty much dummies about installations...)  Could InstallShield (pro) handle it?  Could we write a Java program to do it?  I looked at the Scheduled Task itself, with WordPad, and it's not in plain text.  

Thanks a lot!
--BrianMc1958
0
Comment
Question by:BrianMc1958
  • 2
  • 2
5 Comments
 

Author Comment

by:BrianMc1958
ID: 16923360
BTW: That was "batch job", not "btach job" or "botched job".
0
 

Assisted Solution

by:saporis
saporis earned 200 total points
ID: 16928067
Please explain further.

Are we going to be using the windows task schedualer?

Or, in a PROGRAMMING sense?  I have never used any "3rd" party installer, but I'm sure there's a way to detect the string in the "destination box".

Or, in worse case, you can hardcode the program to either use: ".\filehere" so it can run in the current directory without any problems, or, perform "cd \", or, as I have done in the past to sneak out of a linux chroot dungeon, "cd ..", cd .., cd.. cd ..
0
 
LVL 30

Assisted Solution

by:callrs
callrs earned 300 total points
ID: 16930696
You just need to change shortcut properties? It's simple with VBScript. Write a script to:
- Bring up a Browse for Folder dialog
- User selects the Run & Start-in paths
- Paths are returned into two variables
- Now that you you have the values in the variables, you can change the shortcut properties, using code such as this from http://www.codecomments.com/archive299-2004-5-199041.html):
' Create a shortcut object on the desktop
Set WS1 = WSHShell.CreateShortcut("C:\Documents and Settings\All_ Users\Desktop\" & fname & ".lnk")
' Set shortcut object properties and save it
WS1.TargetPath =WSHShell.ExpandEnvironmentStrings("%PCOMM_Root%_ \private\" & fname)
WS1.WorkingDirectory =WSHShell.ExpandEnvironmentStrings("%PCOMM_Root%_ \private")
WS1.WindowStyle = 4
WS1.IconLocation =WSHShell.ExpandEnvironmentStrings("%PCOMM_Root%_ \pcsws.exe, 1")
WS1.Save

0
 

Author Comment

by:BrianMc1958
ID: 16934141
Sorry.  I should have been more clear.

Ideally, what will happen is that the user will choose a particular directory on which to install our product, via InstallShield.  Then (with no futher user intervention) we would somehow plug that directory path into a pre-existing Scheduled Task (which already ships with our product.)  

I'm trying to avoid having the user go to Scheduled Tasks themselves during installation.  
0
 
LVL 30

Accepted Solution

by:
callrs earned 300 total points
ID: 16934832
If the task launches a custom program of your's, why not add this feature to that program:
- extract the install path from the user's registry. The path (in Win 98, XP, etc) is stored in the user's registry upon install.
- use that path to from a working directory path & update the shortcut on the users computer.

Or maybe better, make a separate program that will do the above steps just once on first-run.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

815 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now