Công cụ nhỏ này về cơ bản là giúp sao chép văn bản và loại bỏ “dòng mới, ngắt dòng” sau mỗi dòng. Tool này đặc biệt giúp ích khi sao chép và dán văn bản từ một file PDF
Video demo
Code 1
@echo off @break off @title TrinhTB-Clipboard @CLS chcp 65001 setlocal EnableDelayedExpansion set "mypath=%~dp0" cd /d %mypath% >clipboard.temp=(powershell -command "Get-Clipboard") for /f "delims=" %%a in (clipboard.temp) do ( set "line=!line! %%a" ) rem !line!>clipboardfile.tmp rem clip<clipboardfile.tmp echo "!line!"|clip del clipboard.temp endlocal exit
Code 2
<# : bat File @echo off @break off @title TrinhTB-Clipboard @CLS chcp 65001 setlocal EnableDelayedExpansion set "mypath=%~dp0" cd /d %mypath% for /f "delims=" %%a in ('powershell -noprofile "iex (${%~f0} | out-string)"') do ( set "line=!line! %%a" ) echo "!line!" | clip endlocal exit : end Batch #> Get-Clipboard
Code 3
<# : bat File @echo off @break off @title TrinhTB-Clipboard chcp 65001 @CLS set "mypath=%~dp0" cd /d %mypath% set ^"LF=^ " powershell -noprofile -command "$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding; $mysw='clipboard'; $myargs=$null; Invoke-Expression (${%~f0} | out-string)" :End endlocal exit : end Batch #> <# : comment Add-Type -AssemblyName PresentationCore,PresentationFramework $ButtonType = [System.Windows.MessageBoxButton]::YesNoCancel $MessageIcon = [System.Windows.MessageBoxImage]::Error $MessageBody = $myargs $MessageTitle = "Confirm " $Result = [System.Windows.MessageBox]::Show($MessageBody,$MessageTitle,$ButtonType,$MessageIcon) if($Result -eq "Yes") { Write-Host "$Result" } $myargs=$null; if (!($myargs)) { write "Zero, null or Empty"} : comment #> Add-Type -AssemblyName System.Windows.Forms switch ($mysw) { "clipboard" { $myClipboard = Get-Clipboard; $myClipboard=$myClipboard -join ""; [System.Windows.Forms.Clipboard]::Clear(); $myClipboard = $myClipboard.replace([Environment]::NewLine, " ").replace(".","."); Set-Clipboard -Value $myClipboard; break; } }
Lưu code trên với file có phần mở rộng là “.bat” hoặc tải file dưới đây
Recent Comments