Difference between revisions of "Windows Powershell"

From rbachwiki
Jump to navigation Jump to search
(Replaced content with "=POWERSHELL FILEBASED OPERATIONS= = Category=")
Tag: Replaced
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Script that create a folder based on today's date, then copy the contents of one folder to another==
=[[POWERSHELL FILEBASED OPERATIONS]]=
<pre>
$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
</pre>
'''save with .ps1 extension'''
== CD  to a specific directory ==
set-location 'g:\box\All Flds\web\amazon\test'
=[[Windows| Category]]=
=[[Windows| Category]]=

Latest revision as of 16:38, 13 October 2021