Difference between revisions of "Windows Powershell"
Jump to navigation
Jump to search
Line 2: | Line 2: | ||
<pre> | <pre> | ||
$datecurrent = get-date -Format MM-dd-yyyy | $datecurrent = get-date -Format MM-dd-yyyy | ||
$apath = "C:\Users\ | $apath = "C:\Users\john\Desktop\leaves" | ||
$btest = "C:\Users\ | $btest = "C:\Users\john\Desktop\leaves\pdf-sliced" | ||
$ctest = "C:\Users\ | $ctest = "C:\Users\john\Desktop\leaves\atest" | ||
#create directory | #create directory | ||
Line 19: | Line 19: | ||
'''save with .ps1 extension''' | '''save with .ps1 extension''' | ||
== CD to a specific directory == | == CD to a specific directory == | ||
set-location 'g:\ | set-location 'g:\box\All Flds\web\amazon\test' | ||
=[[Windows| Category]]= | =[[Windows| Category]]= |
Revision as of 15:05, 31 March 2020
Script that create a folder based on today's date, then copy the contents of one folder to another
$datecurrent = get-date -Format MM-dd-yyyy $apath = "C:\Users\john\Desktop\leaves" $btest = "C:\Users\john\Desktop\leaves\pdf-sliced" $ctest = "C:\Users\john\Desktop\leaves\atest" #create directory New-Item -ItemType directory -Path "$ctest\$datecurrent" #open folder ii "$ctest\$datecurrent" #copy files Copy-Item -Path $btest\* -Destination "$ctest\$datecurrent" -Verbose
save with .ps1 extension
CD to a specific directory
set-location 'g:\box\All Flds\web\amazon\test'