Page 1 of 1

Running DOS Batch Files

Posted: Fri May 18, 2018 10:31 am
by DaveCummings
Hello All,
I am sure this has been asked before, but would like to run a batch file against a CSV file. The first few lines are:

Code: Select all

prompt %p$g
CLS
DCARS Radar Processing.
=======================
STAGE 1
-------
ECHO.
Assigning Aircraft Registrations to HEX/MODES codes.
This may take some time....
rem copy d:\processor\incoming\*.csv d:\processor\backups\
process -r -i "d:\processor\incoming\*.csv" "EC-402" "EC-402,Airbus Military,A400M,,Airbus Military,,,Yes"
process -r -i "d:\processor\incoming\*.csv" "EC-404" "EC-404,Airbus Military,A400M,,Airbus Military,,,Yes"
process -r -i "d:\processor\incoming\*.csv" "EC-CCE" "EC-CCE,Cessna,414,,Private,,,Yes"
process -r -i "d:\processor\incoming\*.csv" "EC-CGV" "EC-CGV,Piper,PA-28 180 Cherokee,,Private,,,Yes"
process -r -i "d:\processor\incoming\*.csv" "EC-CHE" "EC-CHE,Beech,King Air A100,,Secretariat of Civil Aviation,,,Yes"
process -r -i "d:\processor\incoming\*.csv" "EC-CJF" "EC-CJF,Cessna,337G Super Skymaster,,Private,,,Yes"
process -r -i "d:\processor\incoming\*.csv" "EC-CSQ" "EC-CSQ,Piper,PA-28R 200 Cherokee Arrow II,,Private,,,Yes"
process -r -i "d:\processor\incoming\*.csv" "EC-CZV" "EC-CZV,Aerotek,Pitts Special S-2A,,Private,,,Yes"
process -r -i "d:\processor\incoming\*.csv" "EC-CZZ" "EC-CZZ,Reims/Cessna,FR172J Rocket,,Private,,,Yes"
Can anyone advise if this would be possible?

Re: Running DOS Batch Files

Posted: Fri May 18, 2018 10:38 am
by jamesh
Looks like that script is calling a program called "process" which is probably the bit that is going to be difficult to replicate under Linux (rewriting the script in bash would probably be fairly easy). Have you got a Linux version of it? Or know what it does?

Re: Running DOS Batch Files

Posted: Fri May 18, 2018 10:42 am
by n67
jamesh wrote:
Fri May 18, 2018 10:38 am
Looks like that script is calling a program called "process" which is probably the bit that is going to be difficult to replicate under Linux (rewriting the script in bash would probably be fairly easy). Have you got a Linux version of it? Or know what it does?
Yeah, my first reaction on seeing this thread was the usual "Oh, you can't run a batch file under LInux, etc, etc, etc:", but then I noticed that this was posted in the Windows 10 for IOT section, so it really has nothing to do with Linux.

I, of course, know nothing about Windows 10 for IOT, but I would guess that there is probably some kind of support for DOS batch files there. If not, then one may have to convert it to PowerShell, which is the latest/current version of the DOS batch language.

Re: Running DOS Batch Files

Posted: Fri May 18, 2018 10:48 am
by DaveCummings
REPLACE is actually a program called FART :
http://www.majorgeeks.com/files/details/fart.html

Re: Running DOS Batch Files

Posted: Fri May 18, 2018 12:27 pm
by jamesh
DaveCummings wrote:
Fri May 18, 2018 10:48 am
REPLACE is actually a program called FART :
http://www.majorgeeks.com/files/details/fart.html
So could be replaced by grep and sed I suspect.

If that is majority of the work, then you could easily rewrite the batch file to run under Linux. I cannot comment on using it under Win10IoT, I know nothing.

Re: Running DOS Batch Files

Posted: Fri May 18, 2018 1:32 pm
by fruitoftheloom
DaveCummings wrote:
Fri May 18, 2018 10:48 am
REPLACE is actually a program called FART :
http://www.majorgeeks.com/files/details/fart.html

This will not run in Windows 10 IoT Core OS, you need a x86 Windows Desktop OS !

Re: Running DOS Batch Files

Posted: Fri May 18, 2018 2:07 pm
by n67
I don't get all these references to either "REPLACE" or "F***", since neither appear in the original posted batch file (*). What exactly ARE we talking about anyway?

Also, REPLACE is an old-school DOS command (and presumably still present in WIN 10), not that that has any relevance to this either.

(*) The batch file seems to be repeated calls to something called "process" - whatever that is.

Re: Running DOS Batch Files

Posted: Fri May 18, 2018 2:37 pm
by jamesh
n67 wrote:
Fri May 18, 2018 2:07 pm
I don't get all these references to either "REPLACE" or "F***", since neither appear in the original posted batch file (*). What exactly ARE we talking about anyway?

Also, REPLACE is an old-school DOS command (and presumably still present in WIN 10), not that that has any relevance to this either.

(*) The batch file seems to be repeated calls to something called "process" - whatever that is.
Good point. I brought up the "process" command in my first post, but then someone decided to chime in with replace and sidetracked everything.

Re: Running DOS Batch Files

Posted: Sat May 19, 2018 8:05 am
by Z80 Refugee
At first glance, it looks like the "process" command takes parameters which specify character string replacements in a file. These things can be accomplished easily in Linux.

Re: Running DOS Batch Files

Posted: Tue Jul 03, 2018 8:39 am
by ptrex
Why don't you try Powershell ...

viewtopic.php?f=105&t=217279

Here is an example on how to read CSV files using Powershell :

https://www.petri.com/powershell-import ... -text-file

Hope this can help ...

rgds,
ptrex