View previous topic :: View next topic |
Author |
Message |
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Feb 07, 2002 4:38 pm Post subject: Get System paths from Registry |
|
|
This is a little routine just to show where and how to obtain various paths from the Windows Registry.
Code: |
rem Find Start Menu
%a = @REGREAD(CURUSER,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,Start Menu)
rem Find Startup Folder
%b = @REGREAD(CURUSER,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,Startup)
rem Find Programs Folder
%c = @REGREAD(CURUSER,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,Programs)
rem Find Fonts Folder
%d = @REGREAD(CURUSER,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,Fonts)
rem Find Recent Files Folder
%e = @REGREAD(CURUSER,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,Recent)
rem Find Favorites Folder
%f = @REGREAD(CURUSER,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,Favorites)
rem Find Desktop Folder
%g = @REGREAD(CURUSER,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,Desktop)
rem Find Sendto Folder
%h = @REGREAD(CURUSER,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,Sendto)
rem Find My Docs Folder
%i = @REGREAD(CURUSER,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,Personal)
%%out = Windows FOLDERS info:@CR()
%%out = %%out@CR()Start Menu = %a
%%out = %%out@CR()Startup = %b
%%out = %%out@CR()Programs = %c
%%out = %%out@CR()Fonts = %d
%%out = %%out@CR()Recent files = %e
%%out = %%out@CR()Favorites = %f
%%out = %%out@CR()Desktop = %g
%%out = %%out@CR()Sendto = %h
%%out = %%out@CR()My Documents = %i
INFO %%out
rem Find Program Files Directory
%j = @REGREAD(LOCAL,SOFTWARE\Microsoft\Windows\CurrentVersion,ProgramFilesDir)
rem Find Common Files Directory
%k = @REGREAD(LOCAL,SOFTWARE\Microsoft\Windows\CurrentVersion,CommonFilesDir)
rem Find Windows Directory = VDS function @windir()
%l = @REGREAD(LOCAL,SOFTWARE\Microsoft\Windows\CurrentVersion,SystemRoot)
rem In Windows 2000 and XP this one is
rem %l = @REGREAD(LOCAL,SOFTWARE\Microsoft\Windows NT\CurrentVersion,SystemRoot)
REM These use the VDS @windir() function
%m = @windir()
%n = @windir(S)
%o = @windir(T)
%%out2 = Windows DIRECTORIES info:@CR()
%%out2 = %%out2@CR()Program Files = %j
%%out2 = %%out2@CR()Common Files = %k
%%out2 = %%out2@CR()Windows dir = %m
%%out2 = %%out2@CR()Windows System = %n
%%out2 = %%out2@CR()Windows Temp = %o
INFO %%out2
rem Find MSIE cache Folder
%p = @REGREAD(CURUSER,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,Cache)
rem Find Cookies Folder
%q = @REGREAD(CURUSER,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,Cookies)
rem Find History Folder
%r = @REGREAD(CURUSER,Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders,History)
%%out3 = MS Internet Explorer Values @cr()
%%out3 = %%out3@CR()Cache = %p
%%out3 = %%out3@CR()Cookies = %q
%%out3 = %%out3@CR()History = %r
INFO %%out3
|
Notes: For some reason @windir(T), unlike all other VDS path output (except root dirs), returns a path with a trailing backslash - perhaps a little bug?
Keep on trucking.
Dr. Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing
Last edited by Dr. Dread on Wed Feb 13, 2002 8:30 am; edited 1 time in total |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Feb 07, 2002 8:07 pm Post subject: |
|
|
I agree not knowing whether a trailing backslash is present
is a nuisance. I use @substr() to check the last char in a path
and either add or remove the backslash to keep everything
the same:
____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Code: |
%p = "c:\windows\"
rem - Remove backslash --
if @equal(@substr(%p, @len(%p)), "\")
%p = @substr(%p, 1, @pred(@len(%p)))
end
INFO test %p
rem - Add backslash --
if @not(@equal(@substr(%p, @len(%p)), "\"))
%p = %p"\"
end
INFO test %p
|
_________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Fri Feb 08, 2002 2:28 pm Post subject: |
|
|
Hey, Mac!
Some say that great minds think alike! Does that go for the feeble-minded, as well?
Anyway, I do almost exactly the same when handling paths because generally roots dirs are returned with a backslash, others aren't.
My approach is almost identical, just with a twist:
Code: |
%X = "c:\windows\"
REM Kill backslash, if any
%L = @LEN(%X)
if @EQUAL(@SUBSTR(%X,%L,),\)
%X = @STRDEL(%X,%L,)
end
info %X
|
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing
Last edited by Dr. Dread on Fri Feb 08, 2002 8:32 pm; edited 1 time in total |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Feb 08, 2002 7:42 pm Post subject: |
|
|
Lol Dr Dread,
Don't mention "feeble-minded", I had forgot about @strdel()... _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Thu Jun 05, 2003 2:29 pm Post subject: |
|
|
Moved this to Knowledge Base. I have looked for this before and I think this is the best place for it. _________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|