Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Detect startup folder HOWTO ?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1556
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Detect startup folder HOWTO ?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Detect startup folder HOWTO ? - 11/2/2004 3:54:44 PM   
  x23

 

Posts: 3
Score: 0
Joined: 11/2/2004
From:
Status: offline
rs.Save "C:\Documents and Settings\All Users.WINDOWS\Start Menu\Programs\Startup\Instant Messenger.exe", adPersistXML
rs.close
conn.close
</script>

This is a snippet of some code I have - now what I have noticed is some people use
"All Users" some need "All Users.WINDOWS" and some don't even have C:\ drive.

Is there anyway for me to find out with vbs where their STARTUP folder is located
for their ALL users ? and also for their local user ? so that I can end up doing

rs.Save startupLoc
rs.Close
...

Help would be greatly appreciated,

Thank you.
 
 
Post #: 1
 
 Re: Detect startup folder HOWTO ? - 11/2/2004 6:25:05 PM   
  OverAtTheBar

 

Posts: 12
Score: 0
Joined: 11/2/2004
From:
Status: offline
On all new Windows OS's, there are 2 startup folders for each person. One is common to all users and one is for the specific user. By using RegRead, you can access these locations if you know what key to look for. In windows 2k the locations are;

User specific:
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Startup

Global Startup:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Common Startup

This will read the key and set the loation to a var.

Set WshShell = WScript.CreateObject( "WScript.Shell" )
Foldera = WshShell.RegRead("a key from above")
Folderb = WshShell.RegRead("the other key from above")

These keys will tell you the exact folders used for the startup. !!!!Remember to use " " around the key names when using WshShell.RegRead("<--these-->") !!!!


You know where to find me,
Corey F.

(in reply to x23)
 
 
Post #: 2
 
 Re: Detect startup folder HOWTO ? - 11/2/2004 11:29:35 PM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
You can also use SpecialFolders.

set WshShell = WScript.CreateObject("WScript.Shell")
strAllDesktop = WshShell.SpecialFolders("AllUsersDesktop")
msgbox StrAllDesktop

Here is a list of all folders that you can get with SpecialFolders
Taken from the help file
AllUsersDesktop
AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup
Templates

(in reply to x23)
 
 
Post #: 3
 
 Re: Detect startup folder HOWTO ? - 11/3/2004 11:18:08 PM   
  x23

 

Posts: 3
Score: 0
Joined: 11/2/2004
From:
Status: offline
These all work yes -

But I am looking for pure VBSCRIPT.

Not "Script Runtime" or "WSH" - as they use ActiveX and
in a .html file will get disabled by Windows.

Anyway to do this ?

(in reply to x23)
 
 
Post #: 4
 
 Re: Detect startup folder HOWTO ? - 11/4/2004 12:47:53 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
What do you consider "pure" vbscript? The script I posted was taken directly from Wscript documentation. It will also work if placed in a HTML page, but you will be prompted due to activeX security. If used in an HTA you will not get this prompt.

(in reply to x23)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Detect startup folder HOWTO ? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts