Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to print notepad++ files from command line\ Batch script.

    Help wanted · · · – – – · · ·
    2
    6
    6451
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Angelberry
      Angelberry last edited by

      Hi,

      I’m trying come up with a batch script that converts all the files in a folder to pdfs and saves them with the same filename along with its previous extension, using notepad++ and cutePdfWriter.

      Trying to do this in 2 steps:

      1. open all the files in notepad++
      2. Print each file and save it in pdf (eg: file1.c.pdf, file1.h.pdf)
        CutePdf is set as a default printer.

      Following is the batch script I used to open all the files in notepad++
      for /r %%x in (*.c) do (
      start “” “C:\Program Files (x86)\Notepad++\notepad++” “%%x”
      )
      However, not finding a command to ‘print’ all the opened files from the command line or a batch script unlike notepad
      Following command opens file1.c in notepad and prints the file in pdf.
      notepad /p file1.c

      notepad++ /p file1.c throws and error “C:\p doesnt exits. Create it?” and opens file1.c in notepad++.

      I aware of the plugin “Printall”, but this doesn’t suit my situation as I have to manually select the folder and files everytime.

      Thanks for your input in advance :).

      Claudia Frank 1 Reply Last reply Reply Quote 0
      • Claudia Frank
        Claudia Frank @Angelberry last edited by

        @Angelberry

        npp doesn’t have such switch but is it needed to use npp anyway?
        I don’t know cutepdf but can’t you do something like

        for /r %%x in (*.c) do (
        print /d \\YOUR_COMPUTER_NAME\cutepdf "%%x".pdf
        )
        

        which of course means that you have shared the pdf printer as cutepdf.

        Please double check the print syntax.

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • Angelberry
          Angelberry last edited by

          Thanks for the input, Claudia.

          The command,
          ‘print /d:\%ComputerName%\CutePDF file1.c’ does display
          “file1.c is currently being printed” on the cmd line but nothing happens.

          when checked “see what’s printing” option of the default printer (Control Panel\Hardware and Sound\Devices and Printers) an error is displayed.
          Document Name - Local Downlevel Document
          Status - Error - Printing

          Claudia Frank 1 Reply Last reply Reply Quote 0
          • Claudia Frank
            Claudia Frank @Angelberry last edited by

            @Angelberry

            if you did it like you wrote than it is wrong.
            the command is, as far as I can remember,

            print /d \\YOUR_COMPUTER_NAME\cutepdf "%%x".pdf
            

            /d is a parameter for a printing device which is the share name of your pdf printer
            \YOUR_COMPUTER_NAME\cutepdf

            but you provided /d:\%ComputerName%\CutePDF
            the colon after d implies a computer device d.

            Cheers
            Claudia

            1 Reply Last reply Reply Quote 0
            • Angelberry
              Angelberry last edited by

              print /d \YOUR_COMPUTER_NAME\CutePDF file1.c

              throws an error : "Invalid switch - /d " .
              Looks like command line is not recognizing the /d switch

              Claudia Frank 1 Reply Last reply Reply Quote 0
              • Claudia Frank
                Claudia Frank @Angelberry last edited by

                @Angelberry

                I’m sorry - my memory about this is wrong.
                Using google I found this which confirms your first syntax.

                Can you double check if you did the necessary steps described in the linked article?

                Cheers
                Claudia

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Copyright © 2014 NodeBB Forums | Contributors