robocopy<\/strong> command would be:<\/p>\n<\/p>\n
By using the :~0,2 syntax, regardless of the folder the batch file is located in, it always copies to the root of the J drive (as the first two characters are J and : ).<\/p>\n
Option 2<\/h3>\n
The other option is a bit different as it only works in a batch or command file. <\/p>\n
<\/p>\n
Parameter zero (%0) in batch file represents the full path of the currently executing file (path and filename). The (dp) modifiers expand the value to be the \u201cdrive\u201d and the \u201cpath,\u201d excluding the file name. <\/p>\n
<\/p>\n
You can manipulate the value as well:<\/p>\n
<\/p>\n
I\u2019m immediately going to adopt the first option into all of my \u201crobocopy\u201d batch files.<\/p>\n","protected":false},"excerpt":{"rendered":"
I didn\u2019t know it was this simple, and am posting this information on my blog so I find it in the future, but hopefully this will help someone else! I\u2019ve created a number of batch files over the years which routinely copy files from one location to another, usually as part of a backup strategy. […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[4,5],"tags":[80,79],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pd5QIe-pG","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":22,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/22","url_meta":{"origin":1592,"position":0},"title":"Converting a mapped drive letter to a network path using C#","date":"March 2, 2008","format":false,"excerpt":"Occasionally you might have the need to convert a mapped drive letter to a UNC or network path. For example, a drive letter such as\u00a0 \"Z\" might be mapped to a network share: In this example, the \"Z\" drive is mapped to a \"Personal\" folder on a server named \"Home\".\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2165,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/2165","url_meta":{"origin":1592,"position":1},"title":"Automatic Reconnection of iSCSI Targets in Windows 10 using PowerShell","date":"April 4, 2017","format":false,"excerpt":"When my highly recommended Synology Disk Station reboots for a required update (I've got it set to automatically reboot), a shared Windows 10 PC in our house cannot always successfully reconnect to the iSCSI targets without manual intervention. Unfortunately, I haven't always noticed which has led to several features of\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2017\/04\/2017-04-04_19-07-23.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1773,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1773","url_meta":{"origin":1592,"position":2},"title":"AV Club \/ Our home setup 2012","date":"December 12, 2012","format":false,"excerpt":"I\u2019ve done a lot of reworking of our computers and network recently and thought I\u2019d post some details about the various physical and digital parts that make our humble WiredPrairie home work. Using Google Docs, I created a labeled diagram with most of the moving parts of our house (WOW,\u2026","rel":"","context":"In "Recommendations"","img":{"alt_text":"Home Setup","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2012\/12\/Home-Setup_thumb1.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1541,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1541","url_meta":{"origin":1592,"position":3},"title":"Adobe Lightroom and exporting to subfolders","date":"February 8, 2012","format":false,"excerpt":"For some reason, versions 1 \u2013 3 of Adobe Lightroom cannot export images in a way that mirrors the original structure of your photo library. I can\u2019t offer a reason why other than it was missed by the development and design teams. There\u2019s been enough interest in it apparently that\u2026","rel":"","context":"In "Photography"","img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2012\/02\/image2.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1880,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1880","url_meta":{"origin":1592,"position":4},"title":"Using Windows CSCRIPT to compile a Handlebar.js template","date":"March 28, 2013","format":false,"excerpt":"I was looking for an alternative to using Node.JS for a JavaScript build process today on a Windows machine. I wanted something that relied as much on natively installed elements of a modern Windows PC as possible so that the build process would be portable. So, I broke out my\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2013\/03\/image_thumb9.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":78,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/78","url_meta":{"origin":1592,"position":5},"title":"How to use Vista’s Search Folders (You should try them!)","date":"April 7, 2008","format":false,"excerpt":"If you aren't using Vista's Search Folders yet, you should! (At least try them!). Here's how to create one. I'll use PSD files in this example. PSD files are files created by Photoshop. But you can substitute any file type as you follow along. First, start Windows Search: Windows Start\u2026","rel":"","context":"In "General"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2008\/04\/image-thumb9.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts\/1592"}],"collection":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/comments?post=1592"}],"version-history":[{"count":1,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts\/1592\/revisions"}],"predecessor-version":[{"id":1593,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts\/1592\/revisions\/1593"}],"wp:attachment":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/media?parent=1592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/categories?post=1592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/tags?post=1592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}