@echo off
@cls
::Tested on a Windows 7 x64 Home Premium machine, but invoking powrprof.dll should work on any xp/
::server 2k3 machine and higher
::Script by Rectifier 06-30-2012
::You WILL need to manually edit the sleepact label to include programs that interrupt sleep
:sleepcheck
set choice=
set /p choice="Enter sleep mode? y/n: "
if not "%choice%"=="" set choice=%choice:~0,1%
if /i "%choice%"=="y" goto sleepact
echo Did not choose yes!!!
goto end
::Programs associated with internet traffic are typical culprits for interrupting sleep mode
::Of these programs, p2p file sharing programs such as utorrent definitely interrupt sleep mode
::MCE Standby Tool is a free program to figure out what is potentially blocking/stopping sleep mode
::Uncomment the example taskkill statments to use them!
::The taskkill command works by using the process name, not the name of the application itself
:sleepact
echo Killing off any netprogs!
echo.
::taskkill /f /im utorrent.exe > nul 2>&1
::taskkill /f /im mirc.exe > nul 2>&1
::taskkill /f /im xchat.exe > nul 2>&1
::taskkill /f /im Steam.exe > nul 2>&1
::taskkill /f /im firefox.exe > nul 2>&1
::taskkill /f /im chrome.exe > nul 2>&1
::taskkill /f /im iexplore.exe > nul 2>&1
::taskkill /f /im opera.exe > nul 2>&1
echo.
echo Sleeping automatically in five seconds!
echo.
choice /c:yn /n /t 5 /d y /m "Do you really want to sleep? y/n: "
set slstatus=%ERRORLEVEL%
if "%slstatus%"=="2" (
echo Sleep cancelled.
goto end
) ELSE (
echo ~SLEEP~ | rundll32.exe powrprof.dll,SetSuspendState 0,1,0
)
goto end
:end
echo TASK DONE
ping 127.0.0.1 -n 2 | find "Reply" > nul
exit /b
DOS Batch ffmpeg - 将iPhone mov文件转换为MPF for JavaFX 2
@Echo off
:: Check WMIC is available
WMIC.EXE Alias /? >NUL 2>&1 || GOTO s_error
:: Use WMIC to retrieve date and time for Windows XP Professional or Vista/Windows 7
FOR /F "skip=1 tokens=1-6" %%G IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') DO (
IF "%%~L"=="" goto s_done
Set _yyyy=%%L
Set _mm=00%%J
Set _dd=00%%G
Set _hour=00%%H
SET _minute=00%%I
)
:s_done
:: Pad digits with leading zeros
Set _mm=%_mm:~-2%
Set _dd=%_dd:~-2%
Set _hour=%_hour:~-2%
Set _minute=%_minute:~-2%
::Store current date in a variable called _curdate:
Set _curdate=%_dd%/%_mm%/%_yyyy%
::Change date:
DATE 19/04/2015
::Start Launcher:
CD /d "%~dp0"
start /wait Launcher.exe
pause
::Change date to current date again:
DATE %_curdate%
EXIT
@echo off >nullfile.txt
set Drive=C:
for /F "tokens=7" %%a in ('fsutil volume diskfree %Drive% ^| find /i "# of free"') do set free=%%a
set free=%free:~0,-6%
echo c: %free%