Basics
Less than 1 minute
Basics 관련
Timestamp 출력
#Get the Timestamp
$TimeStamp = Get-Date -F yyyy-MM-dd_HH-mm
Multiline 입력
'`' 을 붙여 커맨드 입력
wsdl2java.bat -u -t -ss -sd -g -b `
-o .\BmsSifDctToProcessMobService `
-uri http://onnara.saas.gcloud.go.kr/bms/service/BmsSifDctToProcessMobService?wsdl
Change Last Modified Date
File
$file = Get-Item C:\Path\TO\File.txt
$file.LastWriteTime = ('YYYY/MM/DD HH:MI:SS')
Folder
$file = Get-Item C:\Path\TO\File.txt
$file.LastWriteTime = ('YYYY/MM/DD HH:MI:SS')
Rename File(s)
one
Rename-Item -Path C:\Path\To\oldFile.txt -NewName C:\Path\To\oldFile.txt
multiple
Get-ChildItem -Path "C:\Path\To\oldFile" -Recurse -Include "*.txt" | Rename-Item -NewName { $_.Name -replace " ","-" }
multiple w/ timestamp
#Get the Timestamp
$TimeStamp = Get-Date -F yyyy-MM-dd_HH-mm
#Get all text files from a Folder and rename them by appending Timestamp
Get-ChildItem -Path "C:\Temp" -Recurse -Include "*.txt" | ForEach-Object {
Rename-Item -Path $_.FullName -NewName "$($_.DirectoryName)\$($_.BaseName)_$TimeStamp$($_.Extension)"
}
Windows Update 확인
&{start ms-settings:windowsupdate;sleep 3;$wshell=New-Object -ComObject wscript.shell;$wshell.SendKeys('{TAB}{TAB}{TAB}{ENTER}')}