Ok, so I've been trying to figure this out for hours with no progress. I have created a batch file to get details of a VHD.
Everything runs fine and produces the expected results when run from the command line in a command prompt. However, when I use drag and drop from file explorer (dragging a vhd file and dropping onto the batch file) the batch file runs without errors but the output (VHD.INFO) is empty.
I'm stumped.
Edited to only include the behaviour:
@echo off
cls
setlocal enabledelayedexpansion
set "_PATH.THIS=%~dp0"
echo HELP | diskpart > %_PATH.THIS%OUTPUT.TMP
TYPE %_PATH.THIS%OUTPUT.TMP
PAUSE
To demonstrate the different behaviour, please run the batch file from the command line once (works) and also run the batch file by double clicking in file explorer (failure in all piping commands).