Cmd sleep command but with timer


  1. Posts : 90
    Microsoft Windows 10 Pro N 64-bit 10240 Multiprocessor Free
       #1

    Cmd sleep command but with timer


    If you could help i found :\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState Sleep but i need -t 180 secs which doesnt work with this and i dont want to use third party programs..

    tyvm
      My Computer


  2. Posts : 809
    Win10
       #2

    In CMD you can use "timeout" or in PowerShell you can use "Start-Sleep" to start a 180s timer. Just create a script with the timeout command followed by the SetSuspendSleep command.

    Or if you want it in one line you can do
    Code:
    timeout /t 180&&rundll32.exe powrprof.dll,SetSuspendState Sleep
      My Computer


  3. Posts : 90
    Microsoft Windows 10 Pro N 64-bit 10240 Multiprocessor Free
    Thread Starter
       #3

    PolarNettles said:
    In CMD you can use "timeout" or in PowerShell you can use "Start-Sleep" to start a 180s timer. Just create a script with the timeout command followed by the SetSuspendSleep command.

    Or if you want it in one line you can do
    Code:
    timeout /t 180&&rundll32.exe powrprof.dll,SetSuspendState Sleep
    ty i actually thought timeout or sleep command but wasnt sure thnx

    for some reason it doesnt work lol .. powershell doesnt recognize && operator so to line bat scripted worked
    Last edited by Cromax; 07 Nov 2017 at 17:41.
      My Computer


  4. Posts : 809
    Win10
       #4

    Sorry, forgot to mention that "&&" only works in CMD. You use ";" to concatenate commands in PowerShell.
      My Computer


  5. Posts : 163
    Windows 10
       #5

    PolarNettles said:
    In CMD you can use "timeout" or in PowerShell you can use "Start-Sleep" to start a 180s timer. Just create a script with the timeout command followed by the SetSuspendSleep command.

    Or if you want it in one line you can do
    Code:
    timeout /t 180&&rundll32.exe powrprof.dll,SetSuspendState Sleep
    This shut down my PC instead of sleeping it.
      My Computer


  6. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #6

    Hello @Frank15,

    In a CMD Prompt try . . .

    Code:
    
    timeout 180 /nobreak >nul && %SystemRoot%\System32\rundll32.exe powrprof.dll, SetSuspendState 0,1,0

    I hope this helps.
    Last edited by Paul Black; 15 Jan 2022 at 05:20.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 04:17.
Find Us




Windows 10 Forums