Results 1 to 4 of 4

Thread: Start command intepretest paramter as file to execute

  1. #1
    Member
    Join Date
    Sep 2007
    Location
    Denmark
    Posts
    856
    Thanks
    45
    Thanked 104 Times in 82 Posts

    Unhappy Start command intepretest paramter as file to execute

    i dont get this if im using the windows start command but keep te filename enclosed in """ it tries tor un any paramters as if it was file as well

    e.g.
    start Something.bat 2
    execute probably and start smethng.bat with the parameter 2

    start "Something.bat" 2
    Windows message box pups up informing me windows couldt not find my file 2

    this pretty much negates me form using start command on bat files with space in them.
    and i used that in my png optimzing batch since i used bat files named after the input filt to avoid collision if multiple instances of my batch is executed

    PNGbest.bat
    Code:
    @ECHO OFF
    set strenght=%2
    if "%2"=="" set strenght=15
    if not "%2"=="" set /a RandIt=(%2/%NUMBER_OF_PROCESSORS%)
    set /a TotalIt=%RandIt%"*%NUMBER_OF_PROCESSORS%
    
    ECHO --- SvenBent's PNGbest is optimizing your PNG file
    ECHO CPU threads: %NUMBER_OF_PROCESSORS%
    ECHO Zopfli compression strenght: %strenght%
    ECHO Random initial tables : %TotalIt%
    If "%3"=="brutal" ECHO Extended brute force: Enabled (not supported)
    ECHO File: %1
    ECHO Size: %~z1
    
    
    
    ECHO --- PNGwolf-Zopfli ---
    pngwolf --in=%1 --out=%1 --zopfli-iterations=%strenght%
    
    
    ECHO --- Finding optimal filter ---
    for %%f in (6,0,1,2,3,4,5) do pngout %1 /f%%f
    
    
    ECHO --- Block split threshold ---
    for %%b in (64,96,128,192,384,512,768,1024,1536,2048,3072,4096,8192,16384,0) do pngout %1 /f6 /b%%b
    
    
    ECHO --- Random initial tables and mixing blocks ---
    if "%2"=="" goto norandom
    
    echo for /l %%%%r in (1,1,%RandIt%) do ( >%1.pngmix.bat
    echo   pngout  %1.thread.%%1.png %1.tmp.%%1.png /r /force /f6 /kp >>%1.pngmix.bat
    echo   Deflopt /b /s %1.tmp.%%1.png >>%1.pngmix.bat
    echo   huffmix %1.thread.%%1.png %1.tmp.%%1.png %1.thread.%%1.png  >>%1.pngmix.bat
    echo   del %1.tmp.%%1.png  >>%1.pngmix.bat
    echo )  >>%1.pngmix.bat
    echo del %1.%%1.tag >>%1.pngmix.bat
    echo exit >>%1.pngmix.bat
    
    for /l %%t in (1,1,%NUMBER_OF_PROCESSORS%) do (
    Copy %1 %1.thread.%%t.png
    echo tag > %1.%%t.tag
    start %1.PNGmix.bat %%t
    )
    
    ECHO Waiting for threads to close
    :keepwait
    timeout 1 >nul
    if exist %1.?.tag goto keepwait
    if exist %1.??.tag goto keepwait
    if exist %1.???.tag goto keepwait
    if exist %1.????.tag goto keepwait
    
    ECHO Final mixing stages
    for /l %%t in (1,1,%NUMBER_OF_PROCESSORS%) do (
    huffmix %1 %1.thread.%%t.png %1
    del %1.thread.%%t.png
    )
    del %1.pngmix.bat
    
    :norandom
    
    
    ECHO --- Optmizing deflate structure ---
    deflopt /b %1
    defluff <%1 >%1.fluff.png
    deflopt /b %1.fluff.png
    huffmix %1 %1.fluff.png %1
    deflopt /b %1
    del %1.fluff.png
    The bolded line is where i get troubles in my batch files however the behavior exist if i just type it manually in a command line box as well.


    Windows 7 sp1 pro
    Intel I5 2500k
    16gb Kingston beast 2400mhz ram
    Asrock P67 Extreme6 motherboard (bios 2.10)

  2. #2
    Member
    Join Date
    Sep 2007
    Location
    Denmark
    Posts
    856
    Thanks
    45
    Thanked 104 Times in 82 Posts
    i figured it out myself. i promised already did try to google it
    but just a few more minutes and i figured it out

    start interprets the first thing inside "" as title for the window

    so just provide a meaningless title surfaced and it works if both the filename is with or without ""

    E.G

    start "title" "something.bat" 2
    works

    start "title" something.bat 2
    works

  3. #3
    Programmer Bulat Ziganshin's Avatar
    Join Date
    Mar 2007
    Location
    Uzbekistan
    Posts
    4,497
    Thanks
    733
    Thanked 659 Times in 354 Posts
    there is http://encode.ru/forums/3-Off-Topic forum section for that themes

  4. #4
    Member
    Join Date
    Sep 2007
    Location
    Denmark
    Posts
    856
    Thanks
    45
    Thanked 104 Times in 82 Posts
    sorry i thought i was in off topic, but i did have multiple instance of encode.ru open.

Similar Threads

  1. Replies: 11
    Last Post: 27th October 2014, 18:39
  2. Ping command and errorlevel
    By SvenBent in forum The Off-Topic Lounge
    Replies: 1
    Last Post: 23rd April 2014, 07:58
  3. Help!!! Need Recompression Command line for Precomp 0.4.3
    By Manjunath in forum Data Compression
    Replies: 9
    Last Post: 13th April 2014, 05:43
  4. command-line calculator for Windows?
    By Alexander Rhatushnyak in forum The Off-Topic Lounge
    Replies: 5
    Last Post: 30th January 2012, 00:40
  5. Start of another BIG and really real Benchmark
    By Simon Berger in forum Forum Archive
    Replies: 31
    Last Post: 15th November 2007, 17:18

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •