Jumat, 25 November 2011

Changing file attributes with "attrib" Mengubah atribut file dengan "ATTRIB"

In addition to their actual content, files also have a set of properties that characterize them (sometimes called metadata .) One set of these properties are the four attributes read-only, hidden, system, and archive . Selain konten yang sebenarnya mereka, file juga memiliki seperangkat sifat yang mencirikan mereka (kadang-kadang disebut metadata .) Satu set properti ini adalah empat atribut read-only, tersembunyi, sistem, dan arsip. The archive attribute is primarily used in backup procedures but the other three can be encountered in various contexts. Atribut arsip terutama digunakan dalam prosedur cadangan tapi tiga lainnya dapat ditemui dalam berbagai konteks. These attributes can be turned on or off with the command "attrib" and its switches. Atribut ini dapat diaktifkan atau dinonaktifkan dengan perintah "ATTRIB" dan switch nya. The great utility of this command is that it can act on subfolders with its switch "/s" and can use the wildcard "*". Utilitas yang besar dari perintah ini adalah bahwa ia dapat bertindak pada subfolder dengan switch "/ s" dan dapat menggunakan wildcard "*". For example, to clear the read-only , system, and hidden attributes from a file use attrib -r -s -h somefile This operation is not uncommon when system files have to be edited. Misalnya, untuk menghapus read-only, sistem, dan atribut tersembunyi dari menggunakan file attrib -r -s -h somefile Operasi ini tidak jarang terjadi bila sistem file harus diedit. To restore the attributes the command is attrib +r +s +h somefile A common situation where it is desirable to clear the read-only attribute from many files is when files are copied from a CD. Untuk mengembalikan atribut perintah ini attrib +r +s +h somefile Sebuah situasi umum di mana diinginkan untuk menghapus atribut read-only dari file banyak adalah ketika file akan disalin dari CD. By default CD files are normally marked read-only. Oleh file CD standar biasanya ditandai hanya-baca. This can interfere with editing. Hal ini dapat mengganggu dengan mengedit. To clear the read-only attribute from all files in a folder and its subfolders use attrib -r somefolder\*.* /s If you want to process all files of a certain type such as MP3, use attrib -r somefolder\*.mp3 /s Untuk menghapus atribut read-only dari semua file dalam folder dan subfolder menggunakan attrib -r somefolder\*.* /s Jika Anda ingin memproses semua file dari jenis tertentu seperti MP3, gunakan attrib -r somefolder\*.mp3 /s
How to make your favorite folder easily accessible in Windows dialog boxes Bagaimana membuat folder favorit Anda dengan mudah diakses di kotak dialog Windows

Another older command that I find handy is "subst". Perintah lain yang lebih tua yang saya temukan berguna adalah "subst". There are certain folders that I use over and over and I like to have ready access to them. Ada folder tertentu yang saya gunakan berulang dan saya ingin memiliki akses siap untuk mereka. One way to do this is to use the command “subst” to assign a drive letter to a folder. Salah satu cara untuk melakukan ini adalah dengan menggunakan perintah "subst" untuk menetapkan huruf drive ke folder. Since drives are at the top of My Computer and any folder trees in browse lists, it makes the folder very easy to get to. Karena drive berada di atas pohon My Computer dan folder apapun dalam daftar isi, itu membuat folder sangat mudah untuk sampai ke. To map the “Z:” drive to a folder "myfolder", enter subst z: myfolder Unless you are working from the parent folder of "myfolder" you will need the full path for it. Untuk peta "Z:" drive ke "myfolder" folder, masukkan subst z: myfolder Kecuali Anda bekerja dari folder induk dari "myfolder" Anda akan memerlukan path lengkap untuk itu. The assignment only lasts until the user logs off or the computer is shut down so I have a one-line batch file in my Startup folder that reinstitutes the assignment. Tugas hanya berlangsung sampai pengguna log off atau komputer dimatikan jadi saya memiliki sebuah file batch satu baris dalam folder Startup saya bahwa reinstitutes tugas.

CONTOH ; untuk menghapus read-only, sistem, dan atribut tersembunyi dari menggunakan file attrib -r -s -h somefile Operasi ini tidak jarang terjadi bila sistem file harus diedit. To restore the attributes the command is attrib +r +s +h somefile A common situation where it is desirable to clear the read-only attribute from many files is when files are copied from a CD. Untuk mengembalikan atribut perintah ini attrib +r +s +h somefile Sebuah situasi umum di mana diinginkan untuk menghapus atribut read-only dari file banyak adalah ketika file akan disalin dari CD. By default CD files are normally marked read-only. Oleh file CD standar biasanya ditandai hanya-baca. This can interfere with editing. Hal ini dapat mengganggu dengan mengedit. To clear the read-only attribute from all files in a folder and its subfolders use attrib -r somefolder\*.* /s If you want to process all files of a certain type such as MP3, use attrib -r somefolder\*.mp3 /s Untuk menghapus atribut read-only dari semua file dalam folder dan subfolder menggunakan attrib -r somefolder\*.* /s Jika Anda ingin memproses semua file dari jenis tertentu seperti MP3, gunakan attrib -r somefolder\*.mp3 /s

Moving files Memindahkan file

The command "move" takes a file from one folder and puts it in another. Perintah "bergerak" mengambil file dari satu folder dan menempatkan di tempat lain. Its ability to use wild cards makes it useful for moving all the files of a given type to another location. Kemampuan untuk menggunakan kartu liar membuatnya berguna untuk memindahkan semua file dari jenis tertentu ke lokasi lain. A command of the type move /y folder1\*.mp3 folder2\ will move all MP3 files from folder1 to folder2 . Perintah dari tipe move /y folder1\*.mp3 folder2\ akan memindahkan semua file MP3 dari folder1 ke Folder2. The switch " /y" is used if you want to prevent the system from asking if it should overwrite existing files of the same name. Switch "/ y" adalah digunakan jika Anda ingin mencegah sistem dari bertanya apakah itu harus menimpa file yang sudah ada dengan nama yang sama. To prevent overwriting, use the switch "/-y". Untuk mencegah Timpa, gunakan switch "/-y".

Cara daftar file dengan "dir"

The "dir" command is not new but it remains one of the most useful for average PC users. Perintah "dir" perintah ini tidak baru tetapi tetap salah satu yang paling berguna untuk pengguna PC rata-rata. If you have ever wanted to make a list of all the files contained in a particular folder, you will have discovered that the Windows GUI provides no easy way to do this. Jika Anda pernah ingin membuat daftar semua file yang terkandung dalam folder tertentu, Anda akan telah menemukan bahwa Windows menyediakan GUI ada cara mudah untuk melakukan ini. It is very straightforward, however, when using the command line. Hal ini sangat mudah, namun, ketika menggunakan baris perintah. The command “dir myfolder” will list the files and folders contained in myfolder . Perintah "dir myfolder" akan daftar file dan folder yang terdapat dalam myfolder. Again, there are switches that provide for various modifications of the command. Sekali lagi, ada switch yang menyediakan berbagai modifikasi dari perintah. For example “/h” will show hidden files and “/s” will list the contents of sub-folders in addition to those of the main folder. Sebagai contoh "/ h" akan menampilkan file tersembunyi dan "/ s" akan daftar isi sub-folder selain yang dari folder utama. Of course, the normal output of the command is to the screen. Tentu saja, output normal perintah adalah untuk layar. To output to a file instead of the screen, the command is dir myfolder >listmyfolder.txt where “>” is the redirection symbol. Untuk output ke file bukan dari layar, perintahnya adalah dir myfolder >listmyfolder.txt mana ">" adalah simbol redirection. The file "listmyfolder.txt" will be created by the command. File "listmyfolder.txt" akan dibuat oleh perintah. Output can also be redirected straight to a printer on the LPT1 port but I think it is better to first create a file and then print from there if hardcopy is desired. Output juga dapat diarahkan langsung ke printer pada port LPT1 tapi saya pikir lebih baik untuk pertama kali membuat file dan kemudian cetak dari sana jika hardcopy diinginkan. These lists can be a lot longer than you might think. Daftar ini dapat jauh lebih lama daripada yang Anda kira. (These days most printers are on USB, anyway.) This use of dir is also available in Windows 98/Me. (Hari-hari ini sebagian besar printer berada di USB, anyway.) Penggunaan dir juga tersedia di Windows 98/Me.

The dir command can also be used to list only files with a given extension. Perintah dir juga dapat digunakan untuk membuat daftar file hanya dengan ekstensi tertentu. For example dir myfolder\*.doc /s >listmyfolder.txt will list all Microsoft Word files in myfolder and its subfolders. Sebagai contoh dir myfolder\*.doc /s >listmyfolder.txt akan menampilkan semua file Microsoft Word di myfolder dan subfolder. This form of the command will also list all the directories and sub-directories. Bentuk perintah juga akan daftar semua direktori dan sub-direktori. If you want a list of filenames only, add the switch /b . Jika Anda ingin daftar nama file saja, tambahkan switch / b. The filename will include the full path. Nama file akan mencakup path lengkap.
Renaming files with "ren" Mengganti nama file dengan "ren"

Renaming aa large number of files can be tedious. Mengganti nama aa sejumlah besar file dapat membosankan. The command ren (also written rename ) is somewhat limited but its ability to use wild cards can sometimes be useful. Ren perintah (juga ditulis nama) adalah agak terbatas namun kemampuannya untuk menggunakan kartu liar kadang-kadang bisa berguna. The basic command is ren file1 file2 The renamed file has to stay in the same folder as the original; this command cannot move files to another folder. Perintah dasar adalah ren file1 file2 nama file harus tinggal dalam folder yang sama seperti aslinya, perintah ini tidak dapat memindahkan file ke folder lain. The wildcard capability can be used to change the extension of all files of a certain type. Kemampuan wildcard dapat digunakan untuk mengubah ekstensi dari semua file dari jenis tertentu. Thus ren *.txt *.doc will rename all text files to have a DOC extension. Jadi ren *.txt *.doc akan mengubah nama semua file teks untuk memiliki ekstensi DOC.

Keluar kode untuk Xcopy

Many commands issue integer exit codes to indicate the status of the command after it is run. Banyak perintah kode bilangan masalah keluar untuk menunjukkan status dari perintah setelah dijalankan. The exit codes for Xcopy are given in Table II. Kode keluar untuk Xcopy diberikan dalam Tabel II. When placed in "If" statements , these error codes can be useful in batch files . Ketika ditempatkan di pernyataan "Jika" , kode-kode kesalahan dapat berguna dalam file batch.
Tabel II. Exit codes for Xcopy Keluar kode untuk Xcopy
0                     : File disalin tanpa kesalahan.
1                     : Tidak ada file yang ditemukan untuk menyalin.
2                     : Pengguna menekan Ctrl + C untuk mengakhiri xcopy.
4.                    : Berbagai kesalahan termasuk memori tidak cukup atau ruang disk, sebuah nama drive tidak valid, atau sintaks tidak valid.
5      : Disk menulis kesalahan terjadi.

Tidak termasuk file dan folder

A useful feature of Xcopy is the ability to exclude certain files and/or folders from being copied by means of the "/Exclude" switch. Sebuah fitur yang berguna dari Xcopy adalah kemampuan untuk mengecualikan file tertentu dan / atau folder dapat disalin dengan cara switch "/ Kecualikan". All names containing a given string of characters can be excluded. Semua nama yang mengandung string tertentu dari karakter dapat dikecualikan. Unfortunately, Microsoft's description of the switch is not a model of clarity. Sayangnya, deskripsi Microsoft switch bukan model kejelasan. In fact, postings on the Internet indicate considerable confusion exists about how to implement this handy feature. Bahkan, posting di Internet menunjukkan ada kebingungan tentang bagaimana untuk mengimplementasikan fitur ini berguna. Perhaps the list below will help clarify how to use it. Mungkin daftar di bawah ini akan membantu menjelaskan bagaimana menggunakannya.
   1. The strings contained in the names of the files and/or folders to be excluded from being copied are not entered directly in the command switch itself. String yang terkandung dalam nama file dan / atau folder yang akan dikecualikan dari disalin tidak dimasukkan langsung dalam perintah switch itu sendiri.
   2. The entry in the command switch is one or more text files that list the strings to be excluded. Entri di saklar perintah adalah file teks satu atau lebih yang daftar string untuk dikecualikan.
   3. The format of the switch is /Exclude:{path}list_of_exclusions.txt Note the colon between Exclude and the name of the file that lists the exclusions. Format switch /Exclude:{path}list_of_exclusions.txt Perhatikan usus antara Kecualikan dan nama dari file yang berisi daftar pengecualian. Although more than one exclusion file can be used, stick with one if you can. Meskipun lebih dari satu file pengecualian dapat digunakan, tetap dengan satu jika Anda bisa.
   4. The name of the file that lists exclusions cannot have spaces. Nama file yang berisi daftar pengecualian tidak dapat memiliki spasi. Quoting does not help. Mengutip tidak membantu.
   5. Be careful with pathnames. Hati-hati dengan nama path. Remember that operations are relative to the working directory for the command prompt. Ingat bahwa operasi relatif ke direktori kerja untuk perintah prompt. I suggest placing the exclusion list in the top directory of the directories being copied and opening the command prompt in the directory just above the directory and sub-directories to be copied. Saya sarankan menempatkan daftar pengecualian dalam direktori atas direktori disalin dan membuka command prompt di direktori di atas direktori dan sub-direktori yang akan disalin. ( Go here if you don't know how to open the command prompt wherever you want.) The various relative paths will then be simple. ( Buka di sini jika Anda tidak tahu bagaimana untuk membuka command prompt mana pun Anda inginkan.) Jalan berbagai relatif kemudian akan sederhana. If you open the command prompt in the default location, things can get complicated. Jika Anda membuka command prompt di lokasi default, hal-hal yang bisa rumit.
   6. The structure of the exclusions list is one exclusion string per line. Struktur dari daftar pengecualian adalah salah satu pengecualian string yang per baris. Wildcards are not used and do not work. Wildcard tidak digunakan dan tidak bekerja. If you want to exclude all files whose names contain ABC, simply place ABC on one line of the exclusion file. Jika Anda ingin mengecualikan semua file yang berisi ABC, cukup tempatkan ABC pada satu baris dari file pengecualian. If it is being used together with the switch "/S", the exclusion file will apply to sub-directories as well as the main directory. Jika digunakan bersama-sama dengan tombol "/ S", file pengecualian akan berlaku untuk sub-direktori serta direktori utama.
   7. To exclude a particular sub-directory, place its name in the exclusion file with backward slashes before and after its name, viz. , \excluded_directory\ Untuk mengecualikan sebuah sub direktori-tertentu, nama tempat dalam file pengecualian dengan garis miring ke belakang sebelum dan sesudah namanya, yaitu., \excluded_directory\
   8. Use a text editor to create exclusion files. Gunakan editor teks untuk membuat file pengecualian. Do not use Microsoft Word or other word processor unless you are careful to create text files. Jangan menggunakan Microsoft Word atau pengolah kata lain kecuali jika Anda berhati-hati untuk membuat file teks. Use ANSI encoding. Menggunakan pengkodean ANSI. When I tried UTF-8 encoding, the file did not work. Ketika saya mencoba pengkodean UTF-8, file tidak bekerja.

Xcopy-Powerfull dan serbaguna cara untuk menyalin atau back up file

For copying large numbers of files or backing up a large folder, the command line is often the fastest and easiest way to go. Untuk menyalin sejumlah besar file atau back up folder yang besar, baris perintah sering cara tercepat dan termudah untuk pergi. The command “xcopy” is a very useful and powerful command for this purpose. Perintah "xcopy" adalah perintah yang sangat berguna dan kuat untuk tujuan ini. (The old DOS also had an “xcopy” command but it sometimes had trouble with long file names. The XP version has no such problems.) “xcopy” comes with an alphabet soup of assorted switches that give it great versatility for use as a file backup utility. (DOS tua juga memiliki "xcopy" perintah tetapi kadang-kadang mengalami kesulitan dengan nama file yang panjang Versi XP tidak memiliki masalah seperti itu..) "Xcopy" dilengkapi dengan sup alfabet
Sintaks dari perintah Xcopy
Xcopy has a large number of possible switches, which gives the command a great deal of flexibility. Xcopy memiliki sejumlah besar switch mungkin, yang memberikan perintah banyak fleksibilitas. The syntax for the command is given by: Sintaks untuk perintah ini diberikan oleh:
XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W] [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U] [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/EXCLUDE:file1[+file2][+file3]...]

Upper case letters have been used above but the command is case-insensitive. Huruf besar telah digunakan di atas, tetapi perintahnya adalah case-insensitive. A description of the various switches is given in Table I. Note that Windows Vista has an additional switch "/B". Sebuah deskripsi berbagai switch diberikan dalam Tabel I. Perhatikan bahwa Windows Vista memiliki saklar tambahan "/ B". The function of this switch is to copy a Symbolic Link itself instead of the target of the link. Fungsi dari switch ini adalah untuk menyalin Link simbolik itu sendiri, bukan dari target link. Windows 7 has added "/J" to use unbuffered I/O for large files. Windows 7 telah menambahkan "/ J" untuk menggunakan unbuffered I / O untuk file besar.

Tabel I. Deskripsi switch untuk Xcopy perintah :
/ A          : Salinan hanya file dengan atribut arsip diatur, tidak mengubah atribut.
/ M         : Salinan hanya file dengan mengatur atribut arsip, mematikan atribut arsip. Useful in backup. Berguna dalam cadangan.
/ D: mdy               : Salinan file yang diubah pada atau setelah tanggal yang ditentukan. If no date is given, copies only those files whose source time is newer than the destination time. Jika tanggal tidak diberikan, hanya salinan file yang sumber waktu lebih baru dari waktu tujuan. Useful in backup. Berguna dalam cadangan.
/ P          : Meminta Anda sebelum membuat setiap file tujuan.
/ S           : Salinan direktori dan subdirektori kecuali yang kosong.
/ E           : Salinan direktori dan subdirektori, termasuk yang kosong. Same as /S /E. Sama seperti / S / E. May be used to modify /T. Dapat digunakan untuk memodifikasi / T
/ V          : Memverifikasi setiap file baru. Not used by Windows XP. Tidak digunakan oleh Windows XP
/ W         : Meminta Anda untuk menekan tombol sebelum menyalin
/ C          : Terus menyalin bahkan jika terjadi kesalahan.
/ Saya    : Jika tujuan tidak ada dan menyalin lebih dari satu file, mengasumsikan bahwa tujuan harus direktori.
/ Q          : Apakah tidak menampilkan nama file ketika menyalin.
/ F           : Menampilkan sumber lengkap dan nama file tujuan ketika menyalin.
/ L           : Menampilkan file yang akan disalin.
/ G          : Memungkinkan menyalin file dienkripsi untuk tujuan yang tidak mendukung enkripsi.
/ H          : Salinan tersembunyi dan file sistem juga.
/ R          : Menimpa read-only file.
/ T           : Membuat struktur direktori, tetapi tidak menyalin file. Does not include empty directories or subdirectories. Tidak termasuk direktori kosong atau subdirektori.
/ U          : Salinan hanya file yang sudah ada di tujuan.
/ K          : Salinan atribut. Normal Xcopy will reset read-only attributes. Xcopy normal akan mengatur ulang atribut read-only.
/ N          : Salinan yang dihasilkan menggunakan "singkat" nama. May be necessary when copying from NTFS to FAT16. Mungkin diperlukan ketika menyalin dari NTFS ke FAT16.
/ O          : Salinan kepemilikan file dan informasi ACL.
/ X          : Salinan pengaturan file audit (menyiratkan / O).
/ Y           : Menekan mendorong untuk mengkonfirmasi bahwa Anda ingin menimpa sebuah file tujuan sudah ada. May be preset in the COPYCMD environment variable Mungkin telah diatur dalam variabel lingkungan COPYCMD
/-Y          : Anjuran untuk mengkonfirmasi Anda ingin menimpa sebuah file tujuan sudah ada.
/ Z           : Salinan melalui jaringan dalam mode restartable.
/ MENGECUALIKAN: file1 [file2 +] [+ file3] ...       : Menentukan daftar file yang mengandung string untuk dikecualikan. Tricky to use. Rumit untuk digunakan. See below. Lihat di bawah.
/ B          :               Salinan Link simbolik itu sendiri instesd dari target link. (Windows Vista/Windows 7) (Windows Vista / Windows 7)
/ J           : Salinan menggunakan I unbuffered / O. Recommended for very large files. Direkomendasikan untuk file yang sangat besar. (Windows 7) (Windows 7)
Aplikasi Xcopy
Xcopy provides an excellent tool for backing up selected folders. Xcopy menyediakan alat yang sangat baik untuk back up folder yang dipilih. With appropriate switches, a variety of backup scenarios can be created. Dengan switch yang sesuai, berbagai skenario cadangan dapat dibuat. One possible backup configuration would be to copy only those files that have been changed. Salah satu konfigurasi cadangan yang mungkin akan hanya menyalin file-file yang telah berubah. Here is an example command: xcopy C:\somefolder E:\backupfolder /D /E /C /R /H /I /K /Y This command will copy all files, including those in sub-folders, that are newer in the source folder. Berikut adalah contoh perintah: xcopy C:\somefolder E:\backupfolder /D /E /C /R /H /I /K /Y Perintah ini akan menyalin semua file, termasuk yang di sub-folder, yang baru di folder sumber. It will copy hidden as well as read-only files and will create the destination folder and/or sub-folders if they do not already exist. Ini akan menyalin tersembunyi serta membaca-hanya file dan akan membuat folder tujuan dan / atau sub-folder jika mereka tidak sudah ada.
The next example shows the use of a wildcard; it collects all files of a given type and copies them into one place. Contoh berikut menunjukkan penggunaan wildcard, itu mengumpulkan semua file dari jenis tertentu dan salinan mereka ke satu tempat. The command xcopy C:\*.mp3 E:\mp3folder /S /I /C > E:\mp3List.txt will collect all MP3 files on the C: drive and copy them to a folder on the E: drive. Perintah xcopy C:\*.mp3 E:\mp3folder /S /I /C > E:\mp3List.txt akan mengumpulkan semua file MP3 pada drive C: dan menyalinnya ke folder di E: drive. It also creates a list of the files copied and places the list on the E: drive. Hal ini juga membuat daftar file yang disalin dan tempat daftar di E: drive. This simple command preserves the sub-folder structure. Ini perintah sederhana mempertahankan struktur sub-folder. If desired, a more advanced script could be written that places all MP3 files in one folder with no sub-folders. Jika diinginkan, script yang lebih maju dapat ditulis yang menempatkan semua file MP3 dalam satu folder dengan tidak ada sub-folder.

ads