Solved

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

Posted on 2006-06-16
5
423 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WiFi on/off button location for Toshiba Satellite S855 1 30
forgot pst password 2 39
WinSetup from USB not cooperating 27 78
iPhone v Android phone 7 29
Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

912 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

21 Experts available now in Live!

Get 1:1 Help Now