/    Sign up×
Community /Pin to ProfileBookmark

Get Windows/System folders

Hi guys,

Is there a way in Java Script that I can get the path to the Windows (or any system) folder?

I run the script on the local machine not on a server to interogate a client.

Thanks in advance

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@mrhooNov 13.2006 — There is an ActiveX filesystem object you can use with jscript on windows.

Documentation is on Microsofts active scripting site:

http://msdn.microsoft.com/scripting/
Copy linkTweet thisAlerts:
@lucauwfauthorNov 13.2006 — Thanks for the hint, but it's more of a solution I'm after.

It's not that I'm lazy but I'm an embedded C programmer and have little experience of Java, and little time to invest to learn (not my decision).

My Ectronics when plugged into the USB port generates an HTML file on the mass storage device, it is this that must call a javascript on the local machine that in turn pulls in some pictures and also a Date and Time etc... Hence the reason I need to find a system directory so that my generated HTML knows where to include the script from.


I could solve this problem using VBScript and the FileSystem object (Of which I am more familiar - and is probablly almost identical to what you suggested) but I believe that this will throw out some ActiveX Warning which I am loath to have in the product and require security levels set to the right level.

I'm open to alternative methods, i.e. can HTML use environment variables?

Can javascript access the registry (doubtful I guess)?

Any help or ideas is gratefully appreciated.

Thanks in advance.
Copy linkTweet thisAlerts:
@TeufelaffeNov 16.2006 — WshEnvironment is likely what you are looking for. This MSDN article explains it a lot better than I can. ?


[URL=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/7544483a-b1b3-4b00-bb0e-0d260f1b099a.asp]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/7544483a-b1b3-4b00-bb0e-0d260f1b099a.asp[/URL]

{Edit...}

If you are looking specifically for one of the Windows "Special Folders", there is a SpecialFolders object as well. Here's the MSDN article on that object:

[URL=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/14761fa3-19be-4742-9f91-23b48cd9228f.asp]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/14761fa3-19be-4742-9f91-23b48cd9228f.asp[/URL]
×

Success!

Help @lucauwf spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...