This paper proposes a weighted Equal-cost multipath (W-ECMP) scheme in datacenters using a Programmable Data plane. Nowadays, data center networks face ongoing challenges for higher performance and greater efficiency. Equal-cost multi-path (ECMP) routing, the most common load-balancing scheme used on data center networks, tries to balance the traffic without awareness of the network congestion. To overcome this problem, CONGA and HULA are proposed successively. CONGA has implemented customized ASIC as a part of the switch fabric to collect congestion information distributively. Nevertheless, ASICs solution shows a lack of scalability and flexibility. However, although HULA solves some problems of CONGA by using p4 switch, best path selection strategy in HULA only selects and records the best path, which makes it easy to congest the best path, and HULA uses probes that waste bandwidth and deteriorate the performance. To solve the problems of HULA, W-ECMP chooses a path with a weighted probability to avoid congesting a path quickly. W-ECMP encapsulates the path congestion information into the normal traffic similar to the concept of Inband Network Telemetry (INT) in P4, which increases updating speed as the network loading increases. From experimental results, W - ECMP performs better than HULA does in average flow completion time (FCT).