A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows XP » General XP issues or comments
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

finding "My Documents" from a shell in Windows XP



 
 
Thread Tools Display Modes
  #1  
Old October 14th 04, 02:59 PM
Thant Tessman
external usenet poster
 
Posts: n/a
Default finding "My Documents" from a shell in Windows XP


I'm trying to write a shell script that needs to know where "My
Documents" is. Normally, "My Documents" is located in your home
directory, which you can use the %HOMEPATH% environmental variable to
find. However, it is possible to specify a different location (by
right-clicking on the "My Documents" icon).

The problem is that there seems to be no environmental variable that
tells you where it is if it has been moved. There is an entry in the
registry that tells you where it is, but I can't find any easy way to
get at that from a shell script. There are registry tools available in
something called the Resource Kit but writing a shell script that
requires the Resource Kit to be installed seems a bit extreme.

Much obliged for any suggestions,

-thant
Ads
  #2  
Old October 14th 04, 03:03 PM
David Candy
external usenet poster
 
Posts: n/a
Default finding "My Documents" from a shell in Windows XP

What language is your shell script in. XP has 4.

--=20
----------------------------------------------------------
http://www.uscricket.com
"Thant Tessman" wrote in message =
...
=20
I'm trying to write a shell script that needs to know where "My=20
Documents" is. Normally, "My Documents" is located in your home=20
directory, which you can use the %HOMEPATH% environmental variable to=20
find. However, it is possible to specify a different location (by=20
right-clicking on the "My Documents" icon).
=20
The problem is that there seems to be no environmental variable that=20
tells you where it is if it has been moved. There is an entry in the=20
registry that tells you where it is, but I can't find any easy way to=20
get at that from a shell script. There are registry tools available in =


something called the Resource Kit but writing a shell script that=20
requires the Resource Kit to be installed seems a bit extreme.
=20
Much obliged for any suggestions,
=20
-thant

  #3  
Old October 14th 04, 03:45 PM
Jon
external usenet poster
 
Posts: n/a
Default finding "My Documents" from a shell in Windows XP

Might be easier to have a look at vbscript

eg click on the following, pasted into notepad & saved with a .vbs
extension


set WshShell = WScript.CreateObject("WScript.Shell")
path = WshShell.SpecialFolders("MyDocuments")
msgbox path


Jon


"Thant Tessman" wrote in message
...

I'm trying to write a shell script that needs to know where "My Documents"
is. Normally, "My Documents" is located in your home directory, which you
can use the %HOMEPATH% environmental variable to find. However, it is
possible to specify a different location (by right-clicking on the "My
Documents" icon).

The problem is that there seems to be no environmental variable that tells
you where it is if it has been moved. There is an entry in the registry
that tells you where it is, but I can't find any easy way to get at that
from a shell script. There are registry tools available in something
called the Resource Kit but writing a shell script that requires the
Resource Kit to be installed seems a bit extreme.

Much obliged for any suggestions,

-thant



  #4  
Old October 14th 04, 03:50 PM
Thant Tessman
external usenet poster
 
Posts: n/a
Default finding "My Documents" from a shell in Windows XP

David Candy wrote:

What language is your shell script in. XP has 4.


I didn't know that. I'll write it in whatever shell script lets me solve
the problem, but I can't find any documentation on them. What are they
called?

-thant


  #5  
Old October 14th 04, 03:52 PM
Thant Tessman
external usenet poster
 
Posts: n/a
Default finding "My Documents" from a shell in Windows XP

Jon wrote:

Might be easier to have a look at vbscript [...]


Ah, thanks much.

-thant

  #6  
Old October 14th 04, 04:42 PM
David Candy
external usenet poster
 
Posts: n/a
Default finding "My Documents" from a shell in Windows XP

On Error resume next
Set ShellApp =3D CreateObject("Shell.Application")
With ShellApp
MsgBox .Namespace(&hd).Title & vbcrlf & .Namespace(&hd).self.path & =
vbcrlf & "( " & GetShName(.Namespace(&hd).self.path) & " )" , 64, "Check =
My Music Path"
End With

Function GetShName(folderspec)
Dim fso, f
Set fso =3D CreateObject("Scripting.FileSystemObject")
Set f =3D fso.GetFolder(folderspec)
GetShName =3D f.ShortPath
End Function

This does my music (0xd in vb written as &hd - eg 14 in decimal). 0xc =
(13) is the Folder but 0x5 (still 5) is where the files are stored and =
is the one you want.

http://msdn.microsoft.com/scripting

CSIDL

-------------------------------------------------------------------------=
-------

CSIDL values provide a unique system-independent way to identify special =
folders used frequently by applications, but which may not have the same =
name or location on any given system. For example, the system folder may =
be "C:\Windows" on one system and "C:\Winnt" on another.

Constants

CSIDL_FLAG_CREATE (0x8000)=20
Version 5.0. Combine this CSIDL with any of the following CSIDLs to =
force the creation of the associated folder.=20

CSIDL_ADMINTOOLS (0x0030)=20
Version 5.0. The file system directory that is used to store =
administrative tools for an individual user. The Microsoft Management =
Console (MMC) will save customized consoles to this directory, and it =
will roam with the user.=20

CSIDL_ALTSTARTUP (0x001d)=20
The file system directory that corresponds to the user's =
nonlocalized Startup program group.=20

CSIDL_APPDATA (0x001a)=20
Version 4.71. The file system directory that serves as a common =
repository for application-specific data. A typical path is C:\Documents =
and Settings\username\Application Data. This CSIDL is supported by the =
redistributable Shfolder.dll for systems that do not have the =
Microsoft=AE Internet Explorer 4.0 integrated Shell installed.=20

CSIDL_BITBUCKET (0x000a)=20
The virtual folder containing the objects in the user's Recycle Bin. =


CSIDL_CDBURN_AREA (0x003b)=20
Version 6.0. The file system directory acting as a staging area for =
files waiting to be written to CD. A typical path is C:\Documents and =
Settings\username\Local Settings\Application Data\Microsoft\CD Burning.=20

CSIDL_COMMON_ADMINTOOLS (0x002f)=20
Version 5.0. The file system directory containing administrative =
tools for all users of the computer.=20

CSIDL_COMMON_ALTSTARTUP (0x001e)=20
The file system directory that corresponds to the nonlocalized =
Startup program group for all users. Valid only for Microsoft Windows =
NT=AE systems.=20

CSIDL_COMMON_APPDATA (0x0023)=20
Version 5.0. The file system directory containing application data =
for all users. A typical path is C:\Documents and Settings\All =
Users\Application Data.=20

CSIDL_COMMON_DESKTOPDIRECTORY (0x0019)=20
The file system directory that contains files and folders that =
appear on the desktop for all users. A typical path is C:\Documents and =
Settings\All Users\Desktop. Valid only for Windows NT systems.=20

CSIDL_COMMON_DOCUMENTS (0x002e)=20
The file system directory that contains documents that are common to =
all users. A typical paths is C:\Documents and Settings\All =
Users\Documents. Valid for Windows NT systems and Microsoft Windows=AE =
95 and Windows 98 systems with Shfolder.dll installed.=20

CSIDL_COMMON_FAVORITES (0x001f)=20
The file system directory that serves as a common repository for =
favorite items common to all users. Valid only for Windows NT systems.=20

CSIDL_COMMON_MUSIC (0x0035)=20
Version 6.0. The file system directory that serves as a repository =
for music files common to all users. A typical path is C:\Documents and =
Settings\All Users\Documents\My Music.=20

CSIDL_COMMON_PICTURES (0x0036)=20
Version 6.0. The file system directory that serves as a repository =
for image files common to all users. A typical path is C:\Documents and =
Settings\All Users\Documents\My Pictures.=20

CSIDL_COMMON_PROGRAMS (0x0017)=20
The file system directory that contains the directories for the =
common program groups that appear on the Start menu for all users. A =
typical path is C:\Documents and Settings\All Users\Start Menu\Programs. =
Valid only for Windows NT systems.=20

CSIDL_COMMON_STARTMENU (0x0016)=20
The file system directory that contains the programs and folders =
that appear on the Start menu for all users. A typical path is =
C:\Documents and Settings\All Users\Start Menu. Valid only for Windows =
NT systems.=20

CSIDL_COMMON_STARTUP (0x0018)=20
The file system directory that contains the programs that appear in =
the Startup folder for all users. A typical path is C:\Documents and =
Settings\All Users\Start Menu\Programs\Startup. Valid only for Windows =
NT systems.=20

CSIDL_COMMON_TEMPLATES (0x002d)=20
The file system directory that contains the templates that are =
available to all users. A typical path is C:\Documents and Settings\All =
Users\Templates. Valid only for Windows NT systems.=20

CSIDL_COMMON_VIDEO (0x0037)=20
Version 6.0. The file system directory that serves as a repository =
for video files common to all users. A typical path is C:\Documents and =
Settings\All Users\Documents\My Videos.=20

CSIDL_CONTROLS (0x0003)=20
The virtual folder containing icons for the Control Panel =
applications.=20

CSIDL_COOKIES (0x0021)=20
The file system directory that serves as a common repository for =
Internet cookies. A typical path is C:\Documents and =
Settings\username\Cookies.=20

CSIDL_DESKTOP (0x0000)=20
The virtual folder representing the Windows desktop, the root of the =
namespace.=20

CSIDL_DESKTOPDIRECTORY (0x0010)=20
The file system directory used to physically store file objects on =
the desktop (not to be confused with the desktop folder itself). A =
typical path is C:\Documents and Settings\username\Desktop.=20

CSIDL_DRIVES (0x0011)=20
The virtual folder representing My Computer, containing everything =
on the local computer: storage devices, printers, and Control Panel. The =
folder may also contain mapped network drives.=20

CSIDL_FAVORITES (0x0006)=20
The file system directory that serves as a common repository for the =
user's favorite items. A typical path is C:\Documents and =
Settings\username\Favorites.=20

CSIDL_FONTS (0x0014)=20
A virtual folder containing fonts. A typical path is =
C:\Windows\Fonts.=20

CSIDL_HISTORY (0x0022)=20
The file system directory that serves as a common repository for =
Internet history items.=20

CSIDL_INTERNET (0x0001)=20
A virtual folder representing the Internet.=20

CSIDL_INTERNET_CACHE (0x0020)=20
Version 4.72. The file system directory that serves as a common =
repository for temporary Internet files. A typical path is C:\Documents =
and Settings\username\Local Settings\Temporary Internet Files.=20

CSIDL_LOCAL_APPDATA (0x001c)=20
Version 5.0. The file system directory that serves as a data =
repository for local (nonroaming) applications. A typical path is =
C:\Documents and Settings\username\Local Settings\Application Data.=20

CSIDL_MYDOCUMENTS (0x000c)=20
Version 6.0. The virtual folder representing the My Documents =
desktop item. This should not be confused with CSIDL_PERSONAL, which =
represents the file system folder that physically stores the documents.=20

CSIDL_MYMUSIC (0x000d)=20
The file system directory that serves as a common repository for =
music files. A typical path is C:\Documents and Settings\User\My =
Documents\My Music.=20

CSIDL_MYPICTURES (0x0027)=20
Version 5.0. The file system directory that serves as a common =
repository for image files. A typical path is C:\Documents and =
Settings\username\My Documents\My Pictures.=20

CSIDL_MYVIDEO (0x000e)=20
Version 6.0. The file system directory that serves as a common =
repository for video files. A typical path is C:\Documents and =
Settings\username\My Documents\My Videos.=20

CSIDL_NETHOOD (0x0013)=20
A file system directory containing the link objects that may exist =
in the My Network Places virtual folder. It is not the same as =
CSIDL_NETWORK, which represents the network namespace root. A typical =
path is C:\Documents and Settings\username\NetHood.=20

CSIDL_NETWORK (0x0012)=20
A virtual folder representing Network Neighborhood, the root of the =
network namespace hierarchy.=20

CSIDL_PERSONAL (0x0005)=20
The file system directory used to physically store a user's common =
repository of documents. A typical path is C:\Documents and =
Settings\username\My Documents. This should be distinguished from the =
virtual My Documents folder in the namespace, identified by =
CSIDL_MYDOCUMENTS. To access that virtual folder, use =
SHGetFolderLocation, which returns the ITEMIDLIST for the virtual =
location, or refer to the technique described in Managing the File =
System.=20

CSIDL_PRINTERS (0x0004)=20
The virtual folder containing installed printers.=20

CSIDL_PRINTHOOD (0x001b)=20
The file system directory that contains the link objects that can =
exist in the Printers virtual folder. A typical path is C:\Documents and =
Settings\username\PrintHood.=20

CSIDL_PROFILE (0x0028)=20
Version 5.0. The user's profile folder. A typical path is =
C:\Documents and Settings\username. Applications should not create files =
or folders at this level; they should put their data under the locations =
referred to by CSIDL_APPDATA or CSIDL_LOCAL_APPDATA.=20

CSIDL_PROFILES (0x003e)=20
Version 6.0. The file system directory containing user profile =
folders. A typical path is C:\Documents and Settings.=20

CSIDL_PROGRAM_FILES (0x0026)=20
Version 5.0. The Program Files folder. A typical path is C:\Program =
Files.=20

CSIDL_PROGRAM_FILES_COMMON (0x002b)=20
Version 5.0. A folder for components that are shared across =
applications. A typical path is C:\Program Files\Common. Valid only for =
Windows NT, Windows 2000, and Windows XP systems. Not valid for Windows =
Millennium Edition (Windows Me).=20

CSIDL_PROGRAMS (0x0002)=20
The file system directory that contains the user's program groups =
(which are themselves file system directories). A typical path is =
C:\Documents and Settings\username\Start Menu\Programs.=20

CSIDL_RECENT (0x0008)=20
The file system directory that contains shortcuts to the user's most =
recently used documents. A typical path is C:\Documents and =
Settings\username\My Recent Documents. To create a shortcut in this =
folder, use SHAddToRecentDocs. In addition to creating the shortcut, =
this function updates the Shell's list of recent documents and adds the =
shortcut to the My Recent Documents submenu of the Start menu.=20

CSIDL_SENDTO (0x0009)=20
The file system directory that contains Send To menu items. A =
typical path is C:\Documents and Settings\username\SendTo.=20

CSIDL_STARTMENU (0x000b)=20
The file system directory containing Start menu items. A typical =
path is C:\Documents and Settings\username\Start Menu.=20

CSIDL_STARTUP (0x0007)=20
The file system directory that corresponds to the user's Startup =
program group. The system starts these programs whenever any user logs =
onto Windows NT or starts Windows 95. A typical path is C:\Documents and =
Settings\username\Start Menu\Programs\Startup.=20

CSIDL_SYSTEM (0x0025)=20
Version 5.0. The Windows System folder. A typical path is =
C:\Windows\System32.=20

CSIDL_TEMPLATES (0x0015)=20
The file system directory that serves as a common repository for =
document templates. A typical path is C:\Documents and =
Settings\username\Templates.=20

CSIDL_WINDOWS (0x0024)=20
Version 5.0. The Windows directory or SYSROOT. This corresponds to =
the %windir% or %SYSTEMROOT% environment variables. A typical path is =
C:\Windows.=20

Remarks

These values supersede the use of environment variables for this =
purpose.

A CSIDL is used in conjunction with one of four Shell functions, =
SHGetFolderLocation, SHGetFolderPath, SHGetSpecialFolderLocation, and =
SHGetSpecialFolderPath, to retrieve a special folder's path or pointer =
to an item identifier list (PIDL).

Combine CSIDL_FLAG_CREATE with any of the other CSIDLs to force the =
creation of the associated folder. The remaining CSIDLs correspond to =
either file system folders or virtual folders. Where the CSIDL =
identifies a file system folder, a commonly used path is given as an =
example. Other paths may be used. Some CSIDLs can be mapped to an =
equivalent %VariableName% environment variable. CSIDLs are more =
reliable, however, and should be used if possible.

See Also

SHGetFolderLocation, SHGetFolderPath, SHGetSpecialFolderLocation, =
SHGetSpecialFolderPath

-------------------------------------------------------------------------=
-------

=A9 2003 Microsoft Corporation. All rights reserved.=20

--=20
----------------------------------------------------------
http://www.uscricket.com
"Thant Tessman" wrote in message =
...
David Candy wrote:
=20
What language is your shell script in. XP has 4.

=20
I didn't know that. I'll write it in whatever shell script lets me =

solve=20
the problem, but I can't find any documentation on them. What are they =


called?
=20
-thant
=20

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ask Windows XP Expert Walter Clayton About Spyware Chris Norred [MSFT] The Basics 199 July 31st 09 03:55 AM
Windows Startup Taking a Long Time Suzanne Windows XP Help and Support 6 September 23rd 05 07:22 AM
e-machine windowshome xp to real windows xp home Raymond The Basics 8 September 26th 04 10:31 PM
URGENT: Lost all files in My Documents Subodh Windows XP Help and Support 1 September 17th 04 02:10 AM
SP 2 Smiley General XP issues or comments 1 September 10th 04 02:02 AM






All times are GMT +1. The time now is 07:46 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.