Bir toplu iş dosyası oluşturun – bu şekilde çalışır

En basit haliyle, bir toplu iş dosyası (veya toplu komut dosyası), dosyayı açtığınızda yürütülen çeşitli komutların bir listesidir. Toplu dosyaların tarihi DOS'a kadar uzanır ancak aynı zamanda Windows'un modern sürümlerinde de çalışır. Sıradan görevleri otomatikleştirebilir, bir görevi tamamlamak için gereken süreyi azaltabilir ve karmaşık bir süreci herkesin kullanabileceği bir şeye dönüştürebilirsiniz. Size basit bir toplu iş dosyasının nasıl yazılacağını göstereceğiz.

Reklamcılık

Toplu iş dosyası, Windows işletim sistemlerinde, komut satırı yorumlayıcısı tarafından yürütülen bir dizi komutu içeren bir tür komut dosyasıdır. Bu komutlar sırayla çalışarak tekrarlanan görevleri otomatikleştirmenize veya tek bir dosyayla birden fazla komut çalıştırmanıza olanak tanır. Toplu dosyalar “.bat” veya “.cmd” dosya uzantılarını kullanır ve dosyaları kopyalamak, uygulamaları çalıştırmak veya sistem ayarlarını yapılandırmak gibi komutları içerebilir.

Toplu dosyalar, karmaşık işlemleri gerçekleştirmek veya doğrudan etkileşim olmadan görevleri zamanlamak isteyen sistem yöneticileri ve ileri düzey kullanıcılar için özellikle kullanışlıdır. Dosyaları yedekleme, dizinleri temizleme veya tanılama komut dosyalarını çalıştırma gibi bakım görevlerini kolaylaştırmak için kullanılabilirler.

Bir toplu iş dosyasında düz metinle yazılmış bir dizi komut satırı talimatı bulacaksınız. Bu talimatlar, dosya işlemleri (dosyaları kopyalama, taşıma veya silme gibi), programları başlatma veya sistem ayarlarını yapılandırma gibi Windows Komut İstemi'nin (CMD) yürütebileceği herhangi bir geçerli komut olabilir. Toplu iş dosyaları ayrıca, belirli koşullara bağlı olarak görevlerin yürütülmesi üzerinde dinamik kontrole izin veren değişkenler, döngüler ve koşullu ifadeler gibi gelişmiş komut dosyası oluşturma öğelerini de içerebilir.

Toplu dosyalar komut istemiyle aynı dili kullanır. Komut İstemine manuel olarak yazmak yerine, bir dosyayı kullanarak Komut İstemine ne yazmak istediğinizi söylemeniz yeterlidir. Ayrıca prosedürel programlamada kavramsal olarak mümkün olan basit döngüler, koşullu ifadeler vb. gibi bazı mantıkları birleştirmenize de olanak tanır. Burada en önemli komutlardan bazılarına sahibiz:

  • @yankı: Bu parametre, çalışma komut dosyanızı komut isteminde görüntülemenizi sağlar. Toplu iş dosyasında herhangi bir sorunla karşılaşırsanız komut dosyanızla ilgili sorunları görüntülemek için Yankı özelliğini kullanabilirsiniz. Bu parametreye “kapalı” eklerseniz komut isteminde görüntülenmez.
  • başlık: Bu parametre bir parametre ile aynı işlevi yerine getirir. HTML'de etiketleyin ve toplu komut dosyanıza komut istemi penceresinde bir başlık verir.</li> <li><strong>cls</strong>: Komut istemini temizler. Yabancı kodun komut dosyasına erişimi zorlaştırabileceği durumlarda en iyi şekilde kullanılır.</li> <li><strong>rem</strong>: Açıklama kısaltması, açıklama ile aynı işlevi sağlar. <!-- tag in HTML. Rem statements are not included in your code. Instead, they are used to explain the code and provide information, like a comment.</li> <li><strong>%%a</strong>: Any file in a folder.</li> <li><strong>(".")</strong>: The root folder. When using Command Prompt, you need to direct the Command Prompt to a specific directory before changing a file name, deleting a file, etc. With batch files, you just need to paste your file into the directory of your choice.</li> <li><strong>set</strong>: creates, modifies or displays environment variables. Used to store values ​​in variables that can be used later in the script.</li> <li><strong>CD</strong>: is used to navigate to a specific directory before executing commands.</li> <li><strong>copy</strong>: copies files from one location to another.</li> <li><strong>del</strong>: deletes one or more files.</li> <li><strong>start</strong>: launches a separate window to run a specific program or command.</li> <li><strong>pause:</strong> allows a break in the logical chain of your BAT file. This allows the user to read the command lines before continuing with the code. This is represented as "Press any key to continue...".</li> </ul> <p>The batch variable library is huge, to say the least. Fortunately, there is a Wikibook entry that provides an extensive library of batch script parameters and variables: https://de.wikibooks.org/wiki/Batch-Programmierung:_Batch-Kommands. <h3 class="subheading" id="nav_so_erstellen__2">How to create a batch file</h3> <p>A batch file is a text file saved with the .bat file extension. You can write such a file using Notepad or an advanced text editor such as Visual Studio Code (VSCode), but do not use a word processor such as Microsoft Word. Word processing programs typically insert additional formatting elements that prevent your batch script from running correctly.</p> <p>Follow our step-by-step instructions or check out the quick start guide.</p> <a-bilderstrecke class="gallery compact" data-content-id="9971948" data-data-url="/bilderstrecke/4684669.html?view=jsonp" data-debug="0" data-image-cursor="0" data-inline-color-schema="light" data-inline-layout="compact" data-noscript-url="Haber/bilderstrecke/4684669.html?back=9971944" data-title="Batch-Datei erstellen"><span class="image-num" style="display:none">Picture <span class="cur-image">1</span> from <span class="image-count">6</span></span> <div class="gallery-inner"> <figure></figure> </div> <h3>1st step:</h3> <figcaption>First open an empty text file. You can do this, for example, with the Windows application <b>editor </b>make.</figcaption> </a-bilderstrecke> <h3 class="subheading" id="nav_kurzanleitung_3">Quick guide</h3> <ol class="rte__list rte__list--ordered"> <li>Open that <strong>Windows Notepad </strong>and create your batch file there using various commands to perform the desired actions.</li> <li>Then save your text file by clicking on " at the top left of the editor<strong>file</strong>"click and then"<strong>Save as...</strong>" choose.</li> <li>Now enter one you want <strong>names </strong>and make sure that the <strong>File extension </strong>behind the name <strong>.bat</strong> is. Then click on "<strong>Save</strong>".</li> <li>Now to run the batch file, do a <strong>Double click </strong>on it.</li> </ol> <a-collapse class=" a-box a-box--collapsable a-box--full-bordered a-inline-textbox--text a-inline-textbox " media="(min-width: 993px)" sneak-peek="" toggle-class-on-media="a-box--full-bordered"> </a-collapse> <p> <!-- RSPEAK_STOP --><br /> <span class="redakteurskuerzel ISI_IGNORE">(anka)</span><br /> <!-- RSPEAK_START --> </p> </p></div> </div> <div class="wp-block-template-part"> <div style="height:0" aria-hidden="true" class="wp-block-spacer"></div> <div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained" style="margin-top:var(--wp--preset--spacing--70)"> <hr class="wp-block-separator alignwide has-css-opacity is-style-wide"/> <div class="wp-block-columns alignwide has-small-font-size is-layout-flex wp-container-core-columns-is-layout-7495e5c1 wp-block-columns-is-layout-flex" style="margin-top:var(--wp--preset--spacing--30)"> <div class="wp-block-column is-layout-flow wp-container-core-column-is-layout-47e5a185 wp-block-column-is-layout-flow"> <div class="wp-block-group is-layout-flex wp-container-core-group-is-layout-f0ee7b9b wp-block-group-is-layout-flex"> <p> Yayımlandı </p> <div class="wp-block-post-date"><time datetime="2024-10-19T14:01:56+00:00">Ekim 19, 2024</time></div> <p> kategorisi </p> <div class="taxonomy-category wp-block-post-terms"><a href="https://ivobot.oydaf.com/category/1088/" rel="tag">1088</a></div> </div> <div class="wp-block-group is-layout-flex wp-container-core-group-is-layout-f0ee7b9b wp-block-group-is-layout-flex"> <p> yazarı: </p> <div class="wp-block-post-author"><div class="wp-block-post-author__content"><p class="wp-block-post-author__name">admin</p></div></div> </div> </div> <div class="wp-block-column is-layout-flow wp-container-core-column-is-layout-47e5a185 wp-block-column-is-layout-flow"> <div class="wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-d3b4a4c4 wp-block-group-is-layout-flex"> <p> Etiketler: </p> </div> </div> </div> </div> </div> <section class="wp-block-template-part"> <div class="wp-block-group has-global-padding is-layout-constrained wp-container-core-group-is-layout-a666d811 wp-block-group-is-layout-constrained" style="padding-top:var(--wp--preset--spacing--40);padding-right:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--40);padding-left:var(--wp--preset--spacing--40)"> <div class="wp-block-comments"> <h2 class="wp-block-heading">Yorumlar</h2> <div id="respond" class="comment-respond wp-block-post-comments-form"> <h3 id="reply-title" class="comment-reply-title">Bir yanıt yazın <small><a rel="nofollow" id="cancel-comment-reply-link" href="/bir-toplu-is-dosyasi-olusturun-bu-sekilde-calisir/#respond" style="display:none;">Yanıtı iptal et</a></small></h3><form action="https://ivobot.oydaf.com/wp-comments-post.php" method="post" id="commentform" class="comment-form"><p class="comment-notes"><span id="email-notes">E-posta adresiniz yayınlanmayacak.</span> <span class="required-field-message">Gerekli alanlar <span class="required">*</span> ile işaretlenmişlerdir</span></p><p class="comment-form-comment"><label for="comment">Yorum <span class="required">*</span></label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required></textarea></p><p class="comment-form-author"><label for="author">Ad <span class="required">*</span></label> <input id="author" name="author" type="text" value="" size="30" maxlength="245" autocomplete="name" required /></p> <p class="comment-form-email"><label for="email">E-posta <span class="required">*</span></label> <input id="email" name="email" type="email" value="" size="30" maxlength="100" aria-describedby="email-notes" autocomplete="email" required /></p> <p class="comment-form-url"><label for="url">İnternet sitesi</label> <input id="url" name="url" type="url" value="" size="30" maxlength="200" autocomplete="url" /></p> <p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" /> <label for="wp-comment-cookies-consent">Daha sonraki yorumlarımda kullanılması için adım, e-posta adresim ve site adresim bu tarayıcıya kaydedilsin.</label></p> <p class="form-submit wp-block-button"><input name="submit" type="submit" id="submit" class="wp-block-button__link wp-element-button" value="Yorum gönder" /> <input type='hidden' name='comment_post_ID' value='694841' id='comment_post_ID' /> <input type='hidden' name='comment_parent' id='comment_parent' value='0' /> </p></form> </div><!-- #respond --> </div> </div> </section> </main> <footer class="wp-block-template-part"> <div class="wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained"> <div class="wp-block-group alignwide is-content-justification-space-between is-layout-flex wp-container-core-group-is-layout-c07eba30 wp-block-group-is-layout-flex" style="padding-top:var(--wp--preset--spacing--40)"> <p class="has-text-align-right"> <a href="https://wordpress.org" rel="nofollow">WordPress</a> gururla sunar </p> </div> </div> </footer> </div> <script type="speculationrules"> {"prefetch":[{"source":"document","where":{"and":[{"href_matches":"/*"},{"not":{"href_matches":["/wp-*.php","/wp-admin/*","/wp-content/uploads/*","/wp-content/*","/wp-content/plugins/*","/wp-content/themes/twentytwentythree/*","/*\\?(.+)"]}},{"not":{"selector_matches":"a[rel~=\"nofollow\"]"}},{"not":{"selector_matches":".no-prefetch, .no-prefetch a"}}]},"eagerness":"conservative"}]} </script> <script type="module" src="https://ivobot.oydaf.com/wp-includes/js/dist/script-modules/block-library/navigation/view.min.js?ver=b0f909c3ec791c383210" id="@wordpress/block-library/navigation/view-js-module" fetchpriority="low" data-wp-router-options="{"loadOnClientNavigation":true}"></script> <script src="https://ivobot.oydaf.com/wp-includes/js/comment-reply.min.js?ver=6.9.1" id="comment-reply-js" async data-wp-strategy="async" fetchpriority="low"></script> <script id="wp-block-template-skip-link-js-after"> ( function() { var skipLinkTarget = document.querySelector( 'main' ), sibling, skipLinkTargetID, skipLink; // Early exit if a skip-link target can't be located. if ( ! skipLinkTarget ) { return; } /* * Get the site wrapper. * The skip-link will be injected in the beginning of it. */ sibling = document.querySelector( '.wp-site-blocks' ); // Early exit if the root element was not found. if ( ! sibling ) { return; } // Get the skip-link target's ID, and generate one if it doesn't exist. skipLinkTargetID = skipLinkTarget.id; if ( ! skipLinkTargetID ) { skipLinkTargetID = 'wp--skip-link--target'; skipLinkTarget.id = skipLinkTargetID; } // Create the skip link. skipLink = document.createElement( 'a' ); skipLink.classList.add( 'skip-link', 'screen-reader-text' ); skipLink.id = 'wp-skip-link'; skipLink.href = '#' + skipLinkTargetID; skipLink.innerText = 'İçeriğe geç'; // Inject the skip link. sibling.parentElement.insertBefore( skipLink, sibling ); }() ); //# sourceURL=wp-block-template-skip-link-js-after </script> <script id="fifu-json-ld-js-extra"> var fifuJsonLd = {"url":"https://Haberler.cloudimg.io/width/696/q50.png-lossy-50.webp-lossy-50.foil1/_Haber_/imgs/18/4/6/8/4/6/6/9/bat_1-c4a786beefa6fb77.PNG"}; //# sourceURL=fifu-json-ld-js-extra </script> <script src="https://ivobot.oydaf.com/wp-content/plugins/featured-image-from-url/includes/html/js/json-ld.js?ver=4.6.9" id="fifu-json-ld-js"></script> <script id="wp-emoji-settings" type="application/json"> {"baseUrl":"https://s.w.org/images/core/emoji/17.0.2/72x72/","ext":".png","svgUrl":"https://s.w.org/images/core/emoji/17.0.2/svg/","svgExt":".svg","source":{"concatemoji":"https://ivobot.oydaf.com/wp-includes/js/wp-emoji-release.min.js?ver=6.9.1"}} </script> <script type="module"> /*! This file is auto-generated */ const a=JSON.parse(document.getElementById("wp-emoji-settings").textContent),o=(window._wpemojiSettings=a,"wpEmojiSettingsSupports"),s=["flag","emoji"];function i(e){try{var t={supportTests:e,timestamp:(new Date).valueOf()};sessionStorage.setItem(o,JSON.stringify(t))}catch(e){}}function c(e,t,n){e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(t,0,0);t=new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data);e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(n,0,0);const a=new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data);return t.every((e,t)=>e===a[t])}function p(e,t){e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(t,0,0);var n=e.getImageData(16,16,1,1);for(let e=0;e<n.data.length;e++)if(0!==n.data[e])return!1;return!0}function u(e,t,n,a){switch(t){case"flag":return n(e,"\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f","\ud83c\udff3\ufe0f\u200b\u26a7\ufe0f")?!1:!n(e,"\ud83c\udde8\ud83c\uddf6","\ud83c\udde8\u200b\ud83c\uddf6")&&!n(e,"\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f","\ud83c\udff4\u200b\udb40\udc67\u200b\udb40\udc62\u200b\udb40\udc65\u200b\udb40\udc6e\u200b\udb40\udc67\u200b\udb40\udc7f");case"emoji":return!a(e,"\ud83e\u1fac8")}return!1}function f(e,t,n,a){let r;const o=(r="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?new OffscreenCanvas(300,150):document.createElement("canvas")).getContext("2d",{willReadFrequently:!0}),s=(o.textBaseline="top",o.font="600 32px Arial",{});return e.forEach(e=>{s[e]=t(o,e,n,a)}),s}function r(e){var t=document.createElement("script");t.src=e,t.defer=!0,document.head.appendChild(t)}a.supports={everything:!0,everythingExceptFlag:!0},new Promise(t=>{let n=function(){try{var e=JSON.parse(sessionStorage.getItem(o));if("object"==typeof e&&"number"==typeof e.timestamp&&(new Date).valueOf()<e.timestamp+604800&&"object"==typeof e.supportTests)return e.supportTests}catch(e){}return null}();if(!n){if("undefined"!=typeof Worker&&"undefined"!=typeof OffscreenCanvas&&"undefined"!=typeof URL&&URL.createObjectURL&&"undefined"!=typeof Blob)try{var e="postMessage("+f.toString()+"("+[JSON.stringify(s),u.toString(),c.toString(),p.toString()].join(",")+"));",a=new Blob([e],{type:"text/javascript"});const r=new Worker(URL.createObjectURL(a),{name:"wpTestEmojiSupports"});return void(r.onmessage=e=>{i(n=e.data),r.terminate(),t(n)})}catch(e){}i(n=f(s,u,c,p))}t(n)}).then(e=>{for(const n in e)a.supports[n]=e[n],a.supports.everything=a.supports.everything&&a.supports[n],"flag"!==n&&(a.supports.everythingExceptFlag=a.supports.everythingExceptFlag&&a.supports[n]);var t;a.supports.everythingExceptFlag=a.supports.everythingExceptFlag&&!a.supports.flag,a.supports.everything||((t=a.source||{}).concatemoji?r(t.concatemoji):t.wpemoji&&t.twemoji&&(r(t.twemoji),r(t.wpemoji)))}); //# sourceURL=https://ivobot.oydaf.com/wp-includes/js/wp-emoji-loader.min.js </script> </body> </html>