Postingan

Menampilkan postingan dengan label windows

Batch Script mencetak tanggal dengan format YYYY-MM-DD

echo %date:~10,4%-%date:~4,2%-%date:~4,2%

Batch Script untuk mengcopy file terbaru

Misalkan kita memiliki dua buah folder, yaitu folder Asal untuk diperiksa file yang terbaru, dan folder Tujuan untuk tempat menyimpan file terbaru yang berhasil ditemukan. Dan juga spesifik untuk mencari file *.txt yang terbaru. Buatlah script <namascript>.bat dengan isi sebagai berikut: @echo off set dirname="Asal" set copytodir="Tujuan" set newest="" pushd %dirname% for /f "tokens=*" %%a in ('dir /b /od *.txt') do set newest=%%a if %newest%=="" (echo "not found") else (copy %newest% ..\%copytodir%) popd

Batch Script untuk Hapus File Berdasarkan Modify Time

Misalkan kita memiliki folder bernama target , dan akan menghapus file di dalamnya yang modify timenya 30 hari. Buat file hapus.bat dengan notepad. Lalu buat script seperti ini: @echo off set dirname="target" cls Forfiles /p %dirname% /s /d -30 /c "cmd /c del @file" Jalankan script tersebut dengan cmd, atau bisa juga ditaruh di task scheduler.

Deploy QT Windows (*.dll yang dibutuhkan)

Taruh ini di bagian bawah *.pro win32 {     TARGET_CUSTOM_EXT = .exe     DEPLOY_COMMAND = windeployqt     CONFIG( debug, debug|release ) {         # debug         DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/debug/$${TARGET}$${TARGET_CUSTOM_EXT}))     } else {         # release         DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/release/$${TARGET}$${TARGET_CUSTOM_EXT}))     }     # Uncomment the following line to help debug the deploy command when running qmake     #warning($${DEPLOY_COMMAND} $${DEPLOY_TARGET})     QMAKE_POST_LINK = $${DEPLOY_COMMAND} $${DEPLOY_TARGET} }