如何使用notepad ++从txt打开一组文件

时间:2013-01-28 03:57:05

标签: notepad++

例如,我在list.txt中保存了一些链接:

d:\phpnow\htdocs\pm\includes\templates\slucky\common\tpl_gallery_display.php
d:\phpnow\htdocs\pm\includes\templates\slucky\common\tpl_main_page.php
d:\phpnow\htdocs\pm\includes\templates\slucky\templates\tpl_main_page.php
d:\phpnow\htdocs\pm\includes\templates\slucky\templates\tpl_product_info_display.php
d:\phpnow\htdocs\pm\includes\templates\slucky\templates\tpl_product_info_display2.php

我想在记事本++中打开它们。是否有任何插件可以完成这项工作?

7 个答案:

答案 0 :(得分:7)

编写一个名为openfromfiles.bat的批处理文件并执行它。

@echo off
setlocal enableextensions enabledelayedexpansion

set LIST=
for /f %%x in (list.txt) do (
    set LIST=!LIST! "%%x"
    )
    echo %LIST%

"C:\Program Files\Notepad++\notepad++" %LIST%

这里是解释批处理文件的链接.. Windows XP batch file concat

答案 1 :(得分:4)

您不需要新的插件。您可以使用命令行执行此操作,并且必须将所有以空格分隔的文件作为命令行参数。您可以从NotePad ++文档中找到此详细信息。您可以创建一个bat文件来执行命令。

E.g:

<PATH_TO_NOTE_PAD++_FOLDER>/NotePad++.exe "PATH_TO_FILE_1" "PATH_TO_FILE2"

答案 2 :(得分:4)

创建会话文件:

    <NotepadPlus>
        <Session>
            <mainView>
                <File filename="PATH_TO_FILE_1"/>
                <File filename="PATH_TO_FILE_2"/>
                <File filename="PATH_TO_FILE_#"/>
            </mainView>
        </Session>
    </NotepadPlus>

加载它:文件 - &gt;加载会话...

答案 3 :(得分:3)

选择的答案并不好 - 没有长列表。代替:

for /f %%x in (list.txt) do (
    start "" "C:\Program Files\Notepad++\notepad++" "%%x"
    )

答案 4 :(得分:1)

对于Powershell脚本:

    Param
    (
        [Parameter(Mandatory=$true)]$File
    )


    Get-Content -Path $File | foreach {& "C:\Program Files\Notepad++\notepad++" $_}

或powershell contro

    Get-Content -Path <File> | foreach {& "C:\Program Files\Notepad++\notepad++" $_}

位置-列表的文件路径 做得好!

答案 5 :(得分:0)

我使用了Git Bash,以便可以将find的结果传送到Notepad ++:

find . -type f -name "*.csproj" | xargs "C:\Program Files\Notepad++\notepad++.exe"

答案 6 :(得分:-1)

最简单的方法是打开您通常会使用的所有文件。 然后保存会话 将会话文件保存到方便的位置 然后每当要打开该批文件时,使用Notepad ++打开该文件。无需创建脚本,批处理或手动创建会话文件。

相关问题