Where to put files that need to run from a command line

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Where to put files that need to run from a command line

Post by kpassaur » Fri May 01, 2009 11:33 am

I have a command line applicaiton that needs to be run from the directory where the program resides. In XP it is no issue as you can run it in C:\Program Files, naturally this does not work in Vista.

So, I have been using the vbscript example with AppFolder which works, as it ends up in the users profile under Roaming. However, I would prefer it to be in All Users (XP) or Default user (Vista) as everyone is supposed to have read write privleages to files that are placed in a subfolder here.

However, I don't know how to get the path as the example on the forum says to use

VBEval>GetFolder("AllUsersPrograms"),AllUsersPrograms

Which returns the All Users\Start Menu\Programs

If there is a better location I would like to here it. From what I have read this is the best place.

I do not want to use the Windows Temp directory unless I have to as some cleaners have a tendancy to remove things from the temp folder and the command line app needs to stay.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri May 01, 2009 9:16 pm

This posting may be helpful: http://www.mjtnet.com/forum/viewtopic.p ... iable+path

Here is an excerpt from what I posted there:

You should frequently use variable paths in your scripts, especially if they may be compiled to run on other systems. Here is an example of some of them, Marcus has already referred to some of them:

Variable paths, like these:
Built in with Macro Scheduler
%Win_Dir%
%Script_Dir%
%Desktop_Dir%
%Temp_Dir%
%Sys_Dir%

Samples of some others from the Environment
GetEnvVar>HomePath,vHomePath
GetEnvVar>UserProfile,vUserProfile
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Default paths

Post by kpassaur » Fri May 01, 2009 10:19 pm

Thanks Bob,

What I am really looking for is a way to determine if it is c:\Users\Default or C:\Documents and Settings\All Users without doing if Ifdirexists.

Currently I do the current user's path and place some files in the AppFolder and then in a subfolder, however their can be different users so I need the default user \ all folder path and then use the specific users path for their settings.

The rest of the files are in Program files.

I have not found a way for "All Users"

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat May 02, 2009 1:45 am

What is wrong with a few IfDirExists commands?
Only a few lines, and I suspect no significnt performance hit.

Why not put the exeutables in a subfolder in the %Sys_Dir%?
Or can you put them in a shared folder on a shared server?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts