This work proposes a task scheduling method based on virtual machine (VM) matching in clouds. Its objectives are 1) to maximize task scheduling performance and 2) to minimize non-reasonable task allocation, e.g., a simple task to a high-performance VM and thus causing resource waste. A job classifier is utilized to classify tasks and match to a most suitable VM. This work uses the historical data to pre-create VMs of different types. This can save time of creating VMs during task scheduling. Tasks are efficiently matched with concrete VMs dynamically. Task scheduling is accordingly conducted. Experimental results with the Google Cluster Trace dataset show that the proposed method can effectively improve the cloud's task scheduling performance and achieve desired load balancing among various virtual machines in comparison with some existing methods.