{"id":837,"date":"2023-10-28T13:22:17","date_gmt":"2023-10-28T12:22:17","guid":{"rendered":"https:\/\/lavenhamit.uk\/wrdprss\/?p=837"},"modified":"2023-10-28T18:18:42","modified_gmt":"2023-10-28T17:18:42","slug":"copy-folder-contents-with-user-input","status":"publish","type":"post","link":"https:\/\/lavenhamit.uk\/wrdprss\/?p=837","title":{"rendered":"Windows Batch File &#8211; Copy Folder from an Existing Template with User Input"},"content":{"rendered":"\n<p>Paste the following code into a .bat text file to create a runnable script that copies an example template folder with contents to a new folder with a name entered by the user. There are an additional couple of lines that then rename and delete files in the new folder as an example of further customisation that could be automated.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@echo off\npushd %~dp0\nREM request a Directory Name\nset \/p UserInput= \"Create Directory: \"\nREM create directory using a source folder template\nif not exist \"%UserInput%\" (\nmkdir \"%UserInput%\"\nxcopy \/e SourceTemplateFolder \"%UserInput%\"\nREM customise contents\nrename \"%UserInput%\\Content.txt\" NewContent.txt\ndel \"%UserInput%\\FileToDelete.txt\"\n)\npopd<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Paste the following code into a .bat text file to create a runnable script that copies an example template folder [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,67],"tags":[],"class_list":["post-837","post","type-post","status-publish","format-standard","hentry","category-programming-coding-scripting-tips","category-windows-batch-files"],"_links":{"self":[{"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=\/wp\/v2\/posts\/837","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=837"}],"version-history":[{"count":7,"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=\/wp\/v2\/posts\/837\/revisions"}],"predecessor-version":[{"id":849,"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=\/wp\/v2\/posts\/837\/revisions\/849"}],"wp:attachment":[{"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=837"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=837"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lavenhamit.uk\/wrdprss\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=837"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}