Runprogram and %systemroot%

Just starting out? Need help? Post your questions and find answers here.
Snooze
New User
New User
Posts: 7
Joined: Wed Aug 27, 2003 10:28 am
Location: Belgium

Runprogram and %systemroot%

Post by Snooze »

Hi all!

I would like to activate the windows 2000 compatibility dll.

Why this piece of code doesnt work?

Code: Select all

RunProgram("regsvr32", "/s %systemroot%\apppatch\slayerui.dll", "", 1 | 2)
Finally, i've used :

Code: Select all

; find the file with API
path$=Space(255) : r=SearchTreeForFile_("c:\","slayerui.dll",path$)
; register the dll
RunProgram("regsvr32","/s "+path$,"",1 | 2)
It works, but is it possible to use %systemroot% ?
Thanks a lot and sorry for my bad english.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

You need to use GetEnvironmentVariable_() to retrieve the systemroot value. RunProgram() doesn't handle it.
Snooze
New User
New User
Posts: 7
Joined: Wed Aug 27, 2003 10:28 am
Location: Belgium

Ok

Post by Snooze »

Fred wrote:You need to use GetEnvironmentVariable_() to retrieve the systemroot value. RunProgram() doesn't handle it.
Thanks Fred. I will take a look.

Merci pour ce travail fantastique que tu fais sur Purebasic :D
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Thx :)
Hi-Toro
Enthusiast
Enthusiast
Posts: 269
Joined: Sat Apr 26, 2003 3:23 pm

Here ya go

Post by Hi-Toro »

By strange coincidence, I used this yesterday :)

Code: Select all


Procedure.s ExpandEnv (env$)
    ; Call once to get size of required string...
    sizerequired = ExpandEnvironmentStrings_ (env$, dest$, 0)
    If sizerequired
        ; Fill the new string with the path...
        dest$ = Space (sizerequired)
        result = ExpandEnvironmentStrings_ (env$, dest$, 159)
    EndIf
    ProcedureReturn dest$
EndProcedure

Debug ExpandEnv ("%systemroot%")

James Boyd
http://www.hi-toro.com/
Death to the Pixies!
Snooze
New User
New User
Posts: 7
Joined: Wed Aug 27, 2003 10:28 am
Location: Belgium

Post by Snooze »

Excellent, Hi-Toro ! :D

Thanks for your code.
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Re: Here ya go

Post by GPI »

Hi-Toro wrote:By strange coincidence, I used this yesterday :)

Code: Select all


Procedure.s ExpandEnv (env$)
    ; Call once to get size of required string...
    sizerequired = ExpandEnvironmentStrings_ (env$, dest$, 0)
    If sizerequired
        ; Fill the new string with the path...
        dest$ = Space (sizerequired)
        result = ExpandEnvironmentStrings_ (env$, dest$, 159)
    EndIf
    ProcedureReturn dest$
EndProcedure

Debug ExpandEnv ("%systemroot%")

Maybe you should check, which windows is running, because %systemroot% is no envroment-variable in a Win9X-System

GPI
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

GPI:
Snooze wrote:I would like to activate the windows 2000 compatibility dll.
who wants Win89 ??? :D
SPAMINATOR NR.1
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Rings wrote:GPI:
Snooze wrote:I would like to activate the windows 2000 compatibility dll.
who wants Win89 ??? :D
When you have Win89, you should realy take care about it. It is very rare...
Post Reply