Cara Membuat YYMMDDHHIISS di Batch Windows lalu Pindah ke Clipboard
File ini saya buat agar bisa mendapatkan waktu-sekarang. Jadi misalnya saya mengkode file javascript. Nah, untuk dokumentasi, saya catat di file itu kapan waktu dibuatnya.
Awalnya, saya liat tanggal di komputer. Tapi, lama-kelamaan saya menjadi malas untuk nulisnya. Akhirnya kepikiran buat file batch sebagai jalan-pintas.
(Kode)
Nah, cara penggunaannya cukup mudah. 1). buat file dengan ekstensi ".bat" di desktop. Lalu copas kode batch di atas. Simpan. 2). Buka file (doble klik/enter) tinggal cari tempat untuk paste. Misalnya teks-editor, dst.
Selamat mencoba.
Awalnya, saya liat tanggal di komputer. Tapi, lama-kelamaan saya menjadi malas untuk nulisnya. Akhirnya kepikiran buat file batch sebagai jalan-pintas.
(Kode)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: DateTime to Clipboard | |
:: @author anovsiradj (http://ne-a-r.blogspot.com/ncr) <anov.siradj22@gmail.com> | |
:: @created 2016-05-04 , 09:23:44 (kerja3) | |
:: Result (in clipboard) yyyymmddhhii (no ss) | |
::pustaka | |
::http://ss64.com/nt/syntax-substring.html | |
::http://stackoverflow.com/questions/2772456/string-replacement-in-batch-file/2773504#2773504 | |
::http://www.robvanderwoude.com/escapechars.php | |
::http://stackoverflow.com/questions/7105433/windows-batch-echo-without-new-line/7105690#7105690 | |
@echo off | |
set var_date=%date% | |
call set var_date_no_dash=%%var_date:-=%%%% | |
set var_time_no_ms=%time:~0,-6% | |
call set var_time_no_2dot=%%var_time_no_ms:%:=%%%% | |
echo|set /p=%var_date_no_dash%%var_time_no_2dot%|clip | |
exit | |
::pause |
Nah, cara penggunaannya cukup mudah. 1). buat file dengan ekstensi ".bat" di desktop. Lalu copas kode batch di atas. Simpan. 2). Buka file (doble klik/enter) tinggal cari tempat untuk paste. Misalnya teks-editor, dst.
Selamat mencoba.
Komentar
Posting Komentar
Komentar ...