[Tex/LaTex] Using Biber with MiKTeX from command line

biblatexbibliographiesmiktexwindows

I am trying to set up Notepad++ on Windows so that I can compile LaTeX documents from it, using this excellent solution, using a batch file to compile my documents.
However, the example given uses bibtex while I prefer to use biber.

I tried simply replacing all references to bibtex in the batch file with biber, but upon compiling I get errors such as

LaTeX Warning: Empty bibliography on input line 19.

LaTeX Warning: There were undefined references.

Package biblatex Warning: Please (re)run Biber on the file:
(main)                main
(main)                and rerun LaTeX afterwards.

The document compiles correctly apart from the bibliography, which is not found and does not compile.
I know the problem must lie with the batch file, as my MWE compiles fine with TeXStudio and by compiling manually via cmd using the commands

cd [path to directory]
pdflatex main.tex
biber main
pdflatex main.tex

MWE:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[backend=biber, style=ieee, sorting=ynt]{biblatex}

\addbibresource{bibliography.bib}

\title{A Minimum Working Example}
\date{}

\begin{document}

    \maketitle
    \tableofcontents

    \section{Citing a Thing}
        \cite{QuackQuack}

    \printbibliography[heading = bibintoc]
    \nocite{*}

\end{document}

bibliography:

@article{QuackQuack,
   author = {A. Author},
   title = {Quack quack quack},
   journaltitle = {Journal of Ducks},
   volume = {1},
   pages = {1},
   year = {2016}
}

batch file:

::I don't know what the next line does
%~d1
::sets working directory
cd %1
::calls pdflatex and biber on my file
pdflatex %2  
biber %2
pdflatex %2
pdflatex %2
::opens/refreshes the pdf in SumatraPDF
START "" "C:\Program Files\SumatraPDF\SumatraPDF.exe" %3 -reuse-instance

I have checked this question, and have made sure my MiKTeX installation and all packages are up-to-date

I can't find any other solutions to my problem online, and this problem stumps everyone I have asked – any help would be greatly appreciated

Best Answer

I have found the solution to my problem:

The batch script I was running took three parameters-

"$CURRENT_DIRECTORY", represented in the script as %1,

"$(NAME_PART).tex", represented by %2 and

"$(NAME_PART).pdf", represented by %3

This was passing the parameter "main.tex" to biber, which was causing the issue to appear. I edited the script to take 4 parameters, now %3 is passed "$NAME_PART", this is now given to biber, and %4 is now passed the value that was previously passed to %3

The amended script now reads:

%~d1  
cd %1
pdflatex %2  
biber %3
pdflatex %2
START "" "C:\Program Files\SumatraPDF\SumatraPDF.exe" %4 -reuse-instance

This successfully compiles the bibliography and all references. I conclude that biber does not like being given a filename with the .tex extension, and prefers instead to simply be given the filename without extension