I found https://superuser.com/a/97308/514126
When I use it it just prints the program name 'prog' rather than running the program.> set /p x=foo<nul
foo
> _
How can I suppress the blank lines in the shell?
Moderator: DosItHelp
When I use it it just prints the program name 'prog' rather than running the program.> set /p x=foo<nul
foo
> _
I use 'Prog.exe' not 'echo Program'. I get thousands of blank lines written to the shell so the user just sees a blank screen.flywire wrote: ↑15 Feb 2018 04:46...Run Batling.bat as: Batling >Batling.logCode: Select all
@echo off @echo off :: Usage: NestBat [File (without extension) [File (without extension)]] > Batling.bat :: :: Ver 15/02/2018 (CC BY-SA 4.0) :: echo Generating ... :: For %%f in (%1*.dat) do ( echo :: echo ::*** %%f echo copy %%f DAT echo copy %%f.dta DTA echo copy %%f.dtt DTT echo :: :: For %%g in (%2*.per) do ( echo ::** %%g echo copy %%g.per PER echo Program echo copy OUT %%f%%g.out echo :: ) echo :: ) echo done. :End
Code: Select all
Prog.exe 2>nul
Prog.exe 3>nul
...
Prog.exe 9>nul
Code: Select all
con>nul ( prog.exe )
No, I think you are wrong. It is a standard exe like any other program. The line comes from the command processor in the shell not the exe. [edit: Tests show the line does come from the program.]pieh-ejdsch wrote: ↑02 Jun 2018 12:05This prog.exe will print all these empty lines to your command line. It means the standard output isn't into handle1.
Code: Select all
>prog >nul
>_
Code: Select all
>prog
[program output]
>_
Code: Select all
>con>nul (prog.exe)
' ' is not recognized as an internal or external command,
operable program or batch file.
Code: Select all
Set prompt=$g$s
Prog.exe
Echo off
Prog.exe
I'd define an XY problem as a communication problem in which the cause is masked because the person asking for help has presented incomplete information.
If i understand right, what you wrote above:
Code: Select all
@echo off
setlocal enableExtensions disableDelayedExpansion
for /l %%a in (1, 1, 100) do call "a.bat"
for /l %%a in (1, 1, 100) do call :b
for /l %%a in (1, 1, 100) do cmd /c"a.bat"
::...
goto :eof
:b
<nul set /p "=b"
Code: Select all
@echo off
setlocal enableExtensions disableDelayedExpansion
<nul set /p "=a"
Code: Select all
Z:\>test.bat
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Z:\>
Ignore this post if your are not interested to know how others may possibly interpret your post and how it is difficult to diagnose the problem and suggest solutions based on the kind of information that is provided.
It just doesn't make sense. If someone unfamiliar with batch files sees this, hi/she would probably think that there are thousands of file references in a file called batch file which prog.exe is responsible for processing that batch file, But the ones who are familiar with subject can guess that prog.exe is somehow used inside of batch file but it is still unclear how that prog.exe is involved, what is it responsible for ? does it output something to the screen or it just do something to the files?
This part is clear (Maybe the only part)
At first glance this means that the program (prog.exe) is called from inside batch file and all of output of the batch file is redirected to a log file but despite the redirection it still prints blank lines to the console. It seems to be somewhat clear to this point (by guess) but since you related blank line output to calling the prog.exe it is still unclear why you made command processor responsible for printing the blank line to the console. How do you know the blank line is printed by command processor but not prog.exe. You didn't provide any evidence for your claim so others just have to guess or not relay on the incomplete and probably wrong information you provide. (Note that your later explanations made this even more vague and I personally can't decide with certainty what your actual problem is.)
You described that you've tried one of the solutions that is provided by that link. But It added even more to the confusion, just so you know. It is obvious that the solution you tried is not a solution at all but it is trowing out the question what you were trying to achieve with that? you probably was seeking the type of output that is provided by set /p but the thing your were seeking with set /p it is completely unrelated to what you have described before.flywire wrote: ↑02 Jun 2018 05:41I found https://superuser.com/a/97308/514126When I use it it just prints the program name 'prog' rather than running the program.> set /p x=foo<nul
foo
> _
How can I suppress the blank lines in the shell?
What do you mean by: I use 'Prog.exe' not 'echo Program'flywire wrote: ↑02 Jun 2018 10:40I use 'Prog.exe' not 'echo Program'. I get thousands of blank lines written to the shell so the user just sees a blank screen.flywire wrote: ↑15 Feb 2018 04:46...Run Batling.bat as: Batling >Batling.logCode: Select all
@echo off @echo off :: Usage: NestBat [File (without extension) [File (without extension)]] > Batling.bat :: :: Ver 15/02/2018 (CC BY-SA 4.0) :: echo Generating ... :: For %%f in (%1*.dat) do ( echo :: echo ::*** %%f echo copy %%f DAT echo copy %%f.dta DTA echo copy %%f.dtt DTT echo :: :: For %%g in (%2*.per) do ( echo ::** %%g echo copy %%g.per PER echo Prog.exe echo copy OUT %%f%%g.out echo :: ) echo :: ) echo done. :End
Code: Select all
@echo off
:: Usage: NestBat [File (without extension) [File (without extension)]] > Batling.bat
::
:: Ver 15/02/2018 (CC BY-SA 4.0)
::
echo Generating ...>con
::
echo @echo off
For %%f in (%1*.dat) do (
echo ::
echo ::*** %%f
echo copy %%f DAT
echo copy %%f.dta DTA
echo copy %%f.dtt DTT
echo ::
::
For %%g in (%2*.per) do (
echo ::** %%g
echo copy %%g.per PER
echo Program
echo copy OUT %%f%%g.out
echo ::
)
echo ::
)
echo done.>con
:End
Code: Select all
Microsoft Windows [Version 10.0.17134.81]
(c) 2018 Microsoft Corporation. All rights reserved.
E:\bat\NestBat>NestBat > Batling.bat
E:\bat\NestBat>Batling > Batling.log
E:\bat\NestBat>NestBat2 > Batling2.bat
Generating ...
done.
E:\bat\NestBat>Batling2 > Batling2.log
E:\bat\NestBat>
Code: Select all
echo Generating ...
::
::*** E:\bat\NestBat\Best1
copy "E:\bat\NestBat\Best1.dat" DAT
copy "E:\bat\NestBat\Best1.dta" DTA
copy "E:\bat\NestBat\Best1.dtt" DTT
::** E:\bat\NestBat\High
copy "E:\bat\NestBat\High.PER" PER
Program
copy OUT "E:\bat\NestBat\Best1_High.OUT"
::
::** E:\bat\NestBat\Low
copy "E:\bat\NestBat\Low.PER" PER
Program
copy OUT "E:\bat\NestBat\Best1_Low.OUT"
::
::
::
::*** E:\bat\NestBat\Test2
copy "E:\bat\NestBat\Test2.dat" DAT
copy "E:\bat\NestBat\Test2.dta" DTA
copy "E:\bat\NestBat\Test2.dtt" DTT
::** E:\bat\NestBat\High
copy "E:\bat\NestBat\High.PER" PER
Program
copy OUT "E:\bat\NestBat\Test2_High.OUT"
::
::** E:\bat\NestBat\Low
copy "E:\bat\NestBat\Low.PER" PER
Program
copy OUT "E:\bat\NestBat\Test2_Low.OUT"
::
::
::
::*** E:\bat\NestBat\Test3
copy "E:\bat\NestBat\Test3.dat" DAT
copy "E:\bat\NestBat\Test3.dta" DTA
copy "E:\bat\NestBat\Test3.dtt" DTT
::** E:\bat\NestBat\High
copy "E:\bat\NestBat\High.PER" PER
Program
copy OUT "E:\bat\NestBat\Test3_High.OUT"
::
::** E:\bat\NestBat\Low
copy "E:\bat\NestBat\Low.PER" PER
Program
copy OUT "E:\bat\NestBat\Test3_Low.OUT"
::
::
echo done.
Code: Select all
E:\bat\NestBat>echo Generating ...
Generating ...
E:\bat\NestBat>copy "E:\bat\NestBat\Best1.dat" DAT
1 file(s) copied.
E:\bat\NestBat>copy "E:\bat\NestBat\Best1.dta" DTA
1 file(s) copied.
E:\bat\NestBat>copy "E:\bat\NestBat\Best1.dtt" DTT
1 file(s) copied.
E:\bat\NestBat>copy "E:\bat\NestBat\High.PER" PER
1 file(s) copied.
E:\bat\NestBat>Program
[program output]
E:\bat\NestBat>copy OUT "E:\bat\NestBat\Best1_High.OUT"
1 file(s) copied.
E:\bat\NestBat>copy "E:\bat\NestBat\Low.PER" PER
1 file(s) copied.
E:\bat\NestBat>Program
[program output]
E:\bat\NestBat>copy OUT "E:\bat\NestBat\Best1_Low.OUT"
1 file(s) copied.
E:\bat\NestBat>copy "E:\bat\NestBat\Test2.dat" DAT
1 file(s) copied.
E:\bat\NestBat>copy "E:\bat\NestBat\Test2.dta" DTA
1 file(s) copied.
E:\bat\NestBat>copy "E:\bat\NestBat\Test2.dtt" DTT
1 file(s) copied.
E:\bat\NestBat>copy "E:\bat\NestBat\High.PER" PER
1 file(s) copied.
E:\bat\NestBat>Program
[program output]
E:\bat\NestBat>copy OUT "E:\bat\NestBat\Test2_High.OUT"
1 file(s) copied.
E:\bat\NestBat>copy "E:\bat\NestBat\Low.PER" PER
1 file(s) copied.
E:\bat\NestBat>Program
[program output]
E:\bat\NestBat>copy OUT "E:\bat\NestBat\Test2_Low.OUT"
1 file(s) copied.
E:\bat\NestBat>copy "E:\bat\NestBat\Test3.dat" DAT
1 file(s) copied.
E:\bat\NestBat>copy "E:\bat\NestBat\Test3.dta" DTA
1 file(s) copied.
E:\bat\NestBat>copy "E:\bat\NestBat\Test3.dtt" DTT
1 file(s) copied.
E:\bat\NestBat>copy "E:\bat\NestBat\High.PER" PER
1 file(s) copied.
E:\bat\NestBat>Program
[program output]
E:\bat\NestBat>copy OUT "E:\bat\NestBat\Test3_High.OUT"
1 file(s) copied.
E:\bat\NestBat>copy "E:\bat\NestBat\Low.PER" PER
1 file(s) copied.
E:\bat\NestBat>Program
[program output]
E:\bat\NestBat>copy OUT "E:\bat\NestBat\Test3_Low.OUT"
1 file(s) copied.
E:\bat\NestBat>echo done.
done.
Code: Select all
@echo off
:: Usage: NestBat2 [File (without extension) [File (without extension)]] > Batling2.bat
::
:: Ver 15/02/2018 (CC BY-SA 4.0)
::
echo Generating ...>con
::
echo @echo off
for %%F in ("%1*.dat") do (
echo ::
echo ::*** %%~pdnF
echo copy "%%~pdnF.dat" DAT
echo copy "%%~pdnF.dta" DTA
echo copy "%%~pdnF.dtt" DTT
::
for %%G in ("%2*.per") do (
echo ::** %%~pdnG
echo copy "%%~pdnG.PER" PER
echo Program
echo copy OUT "%%~pdnF_%%~nG.OUT"
echo ::
)
echo ::
)
echo done.>con
:End
Code: Select all
@echo off
::
::*** E:\bat\NestBat\Best1
copy "E:\bat\NestBat\Best1.dat" DAT
copy "E:\bat\NestBat\Best1.dta" DTA
copy "E:\bat\NestBat\Best1.dtt" DTT
::** E:\bat\NestBat\High
copy "E:\bat\NestBat\High.PER" PER
Program
copy OUT "E:\bat\NestBat\Best1_High.OUT"
::
::** E:\bat\NestBat\Low
copy "E:\bat\NestBat\Low.PER" PER
Program
copy OUT "E:\bat\NestBat\Best1_Low.OUT"
::
::
::
::*** E:\bat\NestBat\Test2
copy "E:\bat\NestBat\Test2.dat" DAT
copy "E:\bat\NestBat\Test2.dta" DTA
copy "E:\bat\NestBat\Test2.dtt" DTT
::** E:\bat\NestBat\High
copy "E:\bat\NestBat\High.PER" PER
Program
copy OUT "E:\bat\NestBat\Test2_High.OUT"
::
::** E:\bat\NestBat\Low
copy "E:\bat\NestBat\Low.PER" PER
Program
copy OUT "E:\bat\NestBat\Test2_Low.OUT"
::
::
::
::*** E:\bat\NestBat\Test3
copy "E:\bat\NestBat\Test3.dat" DAT
copy "E:\bat\NestBat\Test3.dta" DTA
copy "E:\bat\NestBat\Test3.dtt" DTT
::** E:\bat\NestBat\High
copy "E:\bat\NestBat\High.PER" PER
Program
copy OUT "E:\bat\NestBat\Test3_High.OUT"
::
::** E:\bat\NestBat\Low
copy "E:\bat\NestBat\Low.PER" PER
Program
copy OUT "E:\bat\NestBat\Test3_Low.OUT"
::
::
Code: Select all
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
[program output]
1 file(s) copied.
1 file(s) copied.
[program output]
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
[program output]
1 file(s) copied.
1 file(s) copied.
[program output]
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
1 file(s) copied.
[program output]
1 file(s) copied.
1 file(s) copied.
[program output]
1 file(s) copied.
Code: Select all
echo Prog.exe 2^>nul
Code: Select all
Prog.exe 2>nul
Code: Select all
:: Create NestBat.bat and demo files
::
:: Ver 15/02/2018 (CC BY-SA 4.0)
::
@ ( setlocal
set prompt=$g$s)
@echo off
echo create NestBat and demo files
mkdir NestBat
cd NestBat
call :createNestBat >NestBat.bat
cd ..
echo done ...
pause
exit /b
:createNestBat
echo @echo off
echo ::
echo :: Usage: NestBat [File (without extension) [File (without extension)]]
echo ::
echo :: Ver 15/02/2018 (CC BY-SA 4.0)
echo ::
echo @ ( setlocal
echo set prompt=$g$s)
echo echo Generating ...
echo call :createBatling %%1 %%2 ^>Batling.bat
echo echo done ...
echo exit /b
echo :createBatling
echo For %%%%f in (%%1*.dat) do (
echo echo :: make one DAT DTA DTT
echo echo ::*** %%%%~dpnf
echo echo copy %%%%~ff DAT
echo echo copy %%%%~dpnf.dta DTA
echo echo copy %%%%~dpnf.dtt DTT
echo ::
echo For %%%%g in (%%2*.per) do (
echo echo :: every DAT - make n PER
echo echo ::** %%%%~dpng
echo echo copy %%%%~fg PER
echo echo Program
echo echo copy OUT %%%%~dpnf_%%%%~ng.out
echo echo ::
echo )
echo echo ::**** end %%%%~nf
echo echo ::
echo )
:END createNestBat
:: Test Files
for %%i in ( Best1.dat
Best1.dta
Best1.dtt
Test2.dat
Test2.dta
Test2.dtt
Test3.dat
Test3.dta
Test3.dtt
High.per
Low.per
OUT ) do >%%i echo