I have many scripts wrappers (.exe) that were written for XP. Many have hard paths like c:\winnt or c:\documents and settings...

How should I create a script that will work for both OS version? Are there any examples out there?


Thanks

Nubie
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
It depends on the language of your scripts. In AutoIt, for example, you could simply use the @SystemDir variable to point to the system directory for either OS.
Answered 01/28/2010 by: airwolf
Tenth Degree Black Belt

Please log in to comment
0
Well, if he's sending things to c:\winnt in an XP environment, he probably doesn't actually want them to go to %windir%.
Answered 01/28/2010 by: Jsaylor
Second Degree Blue Belt

Please log in to comment
0
Well, if he's sending things to c:\winnt in an XP environment, he probably doesn't actually want them to go to %windir%.

Well, I was giving an example in AutoIt. There are several variables for finding different types of directories (such as Documents and Settings in XP vs. Users in Vista/7).

My point is we can't help him until he tells us the language his scripts are written in.
Answered 01/28/2010 by: airwolf
Tenth Degree Black Belt

Please log in to comment
0
The answer is pretty much the same no matter what language he's going to be writing in, unless you just want to hand over a boxed answer. Our fine feathered friend here probably isn't aware of the base concept behind it, so that's where we should start.

That answer is: Use environment variables.

Every language has a different interface for how you get to those environment variables, but those are what you're looking for. Andy is correct in that no one can give you a snippet of code to shoehorn into your scripts without knowing what language it's in, but the concept of environment variables is the same regardless of exactly how they're typed in.
Answered 01/28/2010 by: Jsaylor
Second Degree Blue Belt

Please log in to comment
0
Jsaylor has the right idea. ENV variables are the way to go. If the env variables dont point to the directories that you wish you can add variables of your own for any system.
Answered 02/01/2010 by: mtaff
Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity