Earlier I had Windows 8.1 installed on my PC. Then I installed Windows 10. I used to sleep the PC with the following code when I was using 8.1.

but it doesn't work with 10; a CMD window flashes only for a second and nothing happen. How to overcome this issue?
