DOS Batch help needed

May 8, 2009 at 12:08:47
Specs: Windows 7
I've just downloaded a program, what decodes
encoded SVGB files into
normal SVG.
Thats good, but this is a command line application,
and uses inputs like
svgb.exe "Entry01.svg" "Entry01.svg"
svgb.exe "Entry02.svg" "Entry02.svg"
svgb.exe "Entry03.svg" "Entry03.svg"
svgb.exe "Entry04.svg" "Entry04.svg"

But i want to decode more than 2000 files, with
changing name, and I dont
have time to write all the filenames in...

So I decided to ask You to help me with this batch
This batch should do:
dirlist a folder (./svginput as example, changeable in
the code)
save all the filenames and their path (like
send all the data to svgb.exe
set up a folder for output (./svgoutput as example)
decode the files, with the exact filename and path, but
changing the first
subdirectory (./svginput to ./svgoutput)

I don'T know if it is possible or not, I can only make
easy application
running with parameters in batch...
So please help me!

PS: Sorry for the bad english

See More: DOS Batch help needed

Report •

May 8, 2009 at 13:14:34
:: SVGCDC.BAT Usage: svgcdc Source_Folder Dest_Folder
@echo off

if "%~1"=="" goto :ER01
if "%~2"=="" goto :ER01

if not exist  "%~1" goto :ER02
if not exist  "%~2"  md "%~2"

echo.  Starting conversion
echo.     from "%~1"
echo.     to   "%~2"
echo.  Please wait...
pushd "%~1"
for %%j in (*.svg) do (
  svgb "%%j" "%~2\%%j"
  echo.  "%%~dpnxj" -^> "%~2\%%j" >> %~n0.log
echo.  DONE.
goto :EOF

  echo.  Usage: svgcdc Source_Folder Dest_Folder
  goto :EOF

  echo.  Source Folder "%~1" does not exist
  goto :EOF
:: End_Of_Batch

Save it then type e.g.

  svgcdc C:\svgin  D:\svgout

The script produces a log of converted files in the folder of svgcdc named SVGCDC.LOG; to view open it by NotePad.
If Folders have embedded blanks embrace them by double quotes ". In Windows use backslash \ not slash / as under Unix/Linux.

Beware the script was not tersted.

Report •

May 8, 2009 at 13:54:58
Thanks, the script runs correctly!
Any way to make the folder variables editable in the script
itself? so I just have to run it!
A little addition: there are files with .svgb extension too... so i would need to convert those to svg too... and thanks for the fast reply!

Ok, tested the batch, but it wont scan subfolders, and I have to place the svgb.exe in the svg source folder...

Report •

May 8, 2009 at 14:39:47
In Italy now time is late night so, please, be patient and tomoirrow I try to modify the script according to your needs, i.e.

- setting a default variable for source and destination folders if no parameters on the command line.
- scan the subfolders
- scan for .sgvb suffixes.

Others needs, sir?

Report •

Related Solutions

May 8, 2009 at 22:58:23
Thanks, here in Hungary was late too...
So the needs:

-Setting up input-output folders in bat, not in console
-Scan for all subfolders
-Save subfolder path, and make it to output too
( like this: var1 is the svg in, var2 is svg out. scans svgin and founds this:
var1/svgpack1/svg1.svg etcetc, and the output will be var2/svgpack1/svg1.svg)
- The command line won't close after decoding
- The log should contain errors too ( I had some errors coming from undefined commands in the SVG [SVG is an XML-
based vectorgraphic format] and it wasn't in the log, but all the converts
-search for the svgb.exe in the folder of the batch, not in the folder of the svginput
- scanning for SVGB too, but it's output would be svg

I think thats all!
And IVO, thanks for the fast help!

Report •

May 9, 2009 at 04:22:12
You will get what you wish, but i need you explain me the following item that is not clear to me

- The log should contain errors too

Are the error messages produced by svgb.exe while running and are they in a format suitable to be redirected to a log file?
Are they issued to stdout or to stderr?
Do you want the messages in the same file as main log or in a separated error log?
Does svgb.exe return a a condition code to alert on the fine\bad execution?

The work on the other issues is in progress, trust in me. Please contact me by the e-mail private system so I can directly send you the modified script in a better suitable way.

Report •

Ask Question