2Jun/100
Locating Startup Folder in Diffirent Windows Versions
Startup folder lets you to launch applications automatically after user logged in. Sometimes one would like to use such functionality and add own startup scripts. But the problem is that this startup folder has different locations in different Windows versions.
For example, in Windows XP:
%USERPROFILE%\Start Menu\Programs\Startup
But in Windows 7:
%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup
It is possible to determine this Startup folder through registry. Location of record in the registry is:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Startup
And we can write a VBScript, which would read this registry record and create a bat file in Startup folder:
Set oShell = CreateObject("WScript.Shell")
value = oShell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Startup")
oShell.run("cmd /c echo echo hello!!1 > """ & oShell.ExpandEnvironmentStrings(value) & """\hello.bat")