# Re: Win32API, CreateProcess and environment

**URL:** <https://www.ruby-forum.com/t/re-win32api-createprocess-and-environment/59327>\
**Category:** Ruby\
**Created:** [May 3, 2006, 6:57pm UTC](https://www.ruby-forum.com/t/re-win32api-createprocess-and-environment/59327 "2006-05-03T18:57:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [May 3, 2006, 6:57pm UTC](https://www.ruby-forum.com/t/re-win32api-createprocess-and-environment/59327/1 "2006-05-03T18:57:22Z")

</div>

> > From: Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > seems  
> > to work, except that if I attempt to pass an environment  
> > string, it causes  
> > the app to die instantly. What am I doing wrong?
> 
> The ‘notepad’ process requires ‘SystemRoot’ environment  
> variable.

D’oh!

> CreateProcess = Win32API.new(‘kernel32’,‘CreateProcess’, params, ‘I’)  
> startinfo = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
> 
> p create() # ok  
> p create(‘environment’=\>“PATH=C:\;LIB=C:\lib”)
> 
> Regards,
> 
> Park H.

Works great, thanks.

Dan

This communication is the property of Qwest and may contain confidential  
or  
privileged information. Unauthorized use of this communication is  
strictly  
prohibited and may be unlawful. If you have received this communication  
in error, please immediately notify the sender by reply e-mail and  
destroy  
all copies of the communication and any attachments.
