powershell basics
get-childitem
to see the subdirectories in the current directory
get-process
to see the current processes
Create a new folder
New-Item -Type Directory -name FileTest
we can use ls to see if it is created
To see the current working directory or pwd
get-location
Now to get inside a folder or cd
set-location './FileTest/'
to see the contents inside that folder
get-childitem
create a text file
new-item -name test1.text
to delete the text file
remove-item ./test1.text
Using Linux binary or tools installed nside powershell
nano test2.text
write something and save it by ctrl+x
to see the content of the file
Get-Content ./test2.text
to get to the parent folder or cd .. we have to use
set
Set-Location ..
to delete the folder
Remove-Item ./FileTest/
in this case you will be prompted for confirmation
to create 10 text files with names like 1 to 10
1..10|%{new-item -name "test$_.text"}
ls to see the files created like
test1.txt,test2,txt.... test10.txt
get-childitem
to see the subdirectories in the current directory
get-process
to see the current processes
Create a new folder
New-Item -Type Directory -name FileTest
we can use ls to see if it is created
To see the current working directory or pwd
get-location
Now to get inside a folder or cd
set-location './FileTest/'
to see the contents inside that folder
get-childitem
create a text file
new-item -name test1.text
to delete the text file
remove-item ./test1.text
Using Linux binary or tools installed nside powershell
nano test2.text
write something and save it by ctrl+x
to see the content of the file
Get-Content ./test2.text
to get to the parent folder or cd .. we have to use
set
Set-Location ..
to delete the folder
Remove-Item ./FileTest/
in this case you will be prompted for confirmation
to create 10 text files with names like 1 to 10
1..10|%{new-item -name "test$_.text"}
ls to see the files created like
test1.txt,test2,txt.... test10.txt
No comments:
Post a Comment