close_handle = Win32API.new('kernel32', 'CloseHandle', 'L', 'L') create_process = Win32API.new('kernel32', 'CreateProcess', 'PPPPLLLPPP', 'L') startup_info = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].pack('LLLLLLLLLLLLSSLLLL') process_info = [0,0,0,0].pack('LLLL') created = create_process.call( 0, # lpApplicationName "notepad.exe", # lpCommandLine 0, # lpProcessAttributes 0, # lpThreadAttributes 0, # bInheritHandles 0x08, # dwCreationFlags 0, # lpEnvironment "C:/Temp/", # lpCurrentDirectory startup_info, # lpStartupInfo process_info # lpProcessInformation ) close_handle.call(process_info[0,4].unpack('L').first) close_handle.call(process_info[4,4].unpack('L').first)