/build/static/layout/Breadcrumb_cap_w.png

Windows 7

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

Answers (5)

Posted by: airwolf 14 years ago
Red Belt
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.
Posted by: Jsaylor 14 years ago
Second Degree Blue Belt
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%.
Posted by: airwolf 14 years ago
Red Belt
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.
Posted by: Jsaylor 14 years ago
Second Degree Blue Belt
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.
Posted by: mtaff 14 years ago
Yellow Belt
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.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ