[個人筆記] 常用cmd整理

  • 365
  • 0
  • 2019-11-13

純粹備忘錄

強制刪除資料夾

RD /S /Q C:\Users\marshall\Documents\Git\ICS.Settlement

 

將某個檔案強制覆蓋(複製)到指定的資料夾

xcopy /y C:\Users\Desktop\test123\Web.config C:\www\myTestProject

 

PowerShell 刪除bin/obj資料夾

try {Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }}catch{}

 

用MSBuild發布 webform專案

"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe" myWebform.publishproj /p:DeployOnBuild=true /p:PublishProfile="C:\Github\myWebform\App_Data\PublishProfiles\Jenkins.Stage.pubxml" /p:VisualStudioVersion=15.0

 

2秒後執行 將指定資料夾 覆蓋到 另個資料夾

echo off
echo '....123'
timeout /t 2
xcopy /s/y/r C:\Users\user\Desktop\cmd_try\folder_2 C:\Users\user\Desktop\cmd_try\folder_1 /EXCLUDE:C:\Users\user\Desktop\cmd_try\exclude_files.txt
timeout /t 20