windows - Passing powershell variable to robocopy -


i have robocopy job copy files 1 folder location.

"d:\inetpub\www.test.com.au\app_data\indexes" "d:\inetpub\www.test2.com.au\livewww\app_data\examine" /mir /is /mon:1 /mot:5 

this working fine have started using octopus deployment , web root folder ,i.e d:\inetpub\www.test2.com.au\livewww\app_data\examine not same , keeps changing after every deploy like

d:\octopus\dev\presentation.web\2017.9.320-ap\app_data\examine d:\octopus\dev\presentation.web\2017.9.321-ap\app_data\examine d:\octopus\dev\presentation.web\2017.9.322-ap\app_data\examine 

i thinking use powershell current root of website www.test2.com.au , pass location robocopy.

i new powershell , have never worked in powershell question is possible use powershell , robocopy getting current root of website www.test2.com.au , pass robocopy execute command. how possible? appreciated

thanks in advance

yes, looking possible. web server administration module windows powershell includes internet information services (iis) cmdlets let manage configuration , run-time data of iis.

import-module webadministration $physicalpath = get-website "default web site" | % physicalpath 

or, if web application

$physicalpath = get-webapplication "web.application" -site "default web site" | % physicalpath 

now can use $physicalpath variable when invoking external exe such robocopy.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -