Write CMD output to file as UTF-8 - Macro Scheduler Forums
文章推薦指數: 80 %
/s /b /o:gn /A-D > "%FILE_ROOT_PATH%\results.txt" The first part is to set the output format to UTF-8 (chcp 65001) The & tells the command ... Home(current) Products MacroSchedulerStandard MacroSchedulerPro MacroSchedulerLite ProEnterprisePack SimpleMacroRecorder SoftwareDevelopmentKit BuyNow Support KnowledgeBase VideoTutorials CommunityForums ContactUs Blog UserArea Search Quicklinks Unansweredtopics Activetopics Search Theteam FAQ Login Register Boardindex MacroScheduler ScriptsandTips Search WriteCMDoutputtofileasUTF-8 Examplescriptsandtips(replacesOldScripts&Tipsarchive) Moderators:Dorian(MJTsupport),JRL,PhilPendlebury PostReply Search Advancedsearch 1post •Page1of1 Grovkillen AutomationWizard Posts:810Joined:FriAug10,20122:38pm Location:Hudiksvall,Sweden Contact: ContactGrovkillen Website WriteCMDoutputtofileasUTF-8 Quote Post byGrovkillen»MonOct05,20206:56am IhavehadalongtimenagwithmycommandlineoutputtofilebeingnotUTF-8.Ihavenowfoundthesolutiontomyproblem. Code:SelectallLet>FILE_ROOT_PATH=X:\your\path RunProgram>cmd/cchcp65001>nul&cmd/cdir"%FILE_ROOT_PATH%\*.*"/s/b/o:gn/A-D>"%FILE_ROOT_PATH%\results.txt" Tobreakitdown... cmd/cchcp65001>nul & cmd/cdir"%FILE_ROOT_PATH%\*.*"/s/b/o:gn/A-D>"%FILE_ROOT_PATH%\results.txt" ThefirstpartistosettheoutputformattoUTF-8(chcp65001) The&tellsthecommandprompttoexecutethenextpartinthesamerunasthefirst Thethirdpartisthestandardfiledircommandwiththefollowingswitches: /s=listfilesinsubfoldersaswell /b=removetheheaderandfooterpartoftheoutput /o:gn=sortthelistalphabetically /A-D=onlylistfiles Let>ME=%Script% Running:15.0.20 versionhistory Top PostReply 1post •Page1of1 Returnto“ScriptsandTips” Jumpto GeneralandInfo ↳ TheWaterCooler MacroScheduler ↳ Technical/Scripting ↳ GeneralDiscussion ↳ Beginners ↳ ScriptsandTips ↳ EnhancementSuggestions ↳ MacroSchedulerConsultants Boardindex AlltimesareUTC Deleteallboardcookies Theteam Contactus PoweredbyphpBB®ForumSoftware©phpBBLimited Signuptoournewsletterforfreeautomationtips,tricks&discounts Sign uptoournewsletterforfreeautomationtips,tricks& discounts
延伸文章資訊
- 1cmd命令行導出的txt文本文檔編碼格式轉換 - 台部落
如下圖,在原目錄會生成新的txt,編碼格式utf-8,完成轉碼。 ... 在cmd中輸入PowerShell -Command "& {get-content 1.txt -encoding u...
- 2Out-File (Microsoft.PowerShell.Utility)
When you need to specify parameters for the output, use Out-File rather than the ... utf7 : Encod...
- 3Save text file in UTF-8 encoding using cmd.exe - Exchangetuts
How do I change the Encoding to UTF-8?
- 4windows - Save text file in UTF-8 encoding using cmd.exe
The default encoding for command prompt is Windows-1252. Change the code page (chcp command) to 6...
- 5windows cmd視窗,輸出UTF-8格式檔案,顯示亂碼 - 程式人生
可以嘗試在CMD視窗中檢視一個utf-8格式的檔案type <filename.txt>. 如果需要切換回GBK chcp 936 可以換回預設的GBK chcp 437 是美國英語.