1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

CMD Batch Online

Discussion in 'Support' started by aedthuio, Nov 3, 2012.

  1. aedthuio

    Joined:
    Nov 3, 2012
    Messages:
    25
    Likes Received:
    0
    Hi guys! In my website i've put a .cmd batch file.
    Is it possible to run that batch without to save it locally (in the hard drive)?

    Thank you
     
  2. Stein Oiestad

    Joined:
    Sep 11, 2012
    Messages:
    57
    Likes Received:
    1
    If the CALL supported similar feature as COPY then you could avoid any explicit save.

    But a small batch file (or alias) like this would do the trick:

    runweb.cmd

    @echo off
    setlocal
    set URL=user:password@host.domain.com/folder/%1
    copy %URL %TEMP%\%1 /e
    iff exist %TEMP%\%1 then
    call %TEMP%\%1
    *del %TEMP%\%1 /q/e
    else
    echo %URL% not found or download error
    endiff

    endlocal


    If you then had a batch file called mycoolbatchfile.cmd then you would use the following command to run it:

    runweb.cmd mycoolbatchfile.cmd

    I did a quick test of this, and it worked OK for me.

    -stein
     
  3. aedthuio

    Joined:
    Nov 3, 2012
    Messages:
    25
    Likes Received:
    0
    Thank you, but your runweb.cmd save my batch into the %temp% folder. Does exist a way to run a remote batch without to save it in the hard drive?
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,040
    Likes Received:
    84
    Not unless you can access your batch file with a UNC or AFS directory.
     
  5. aedthuio

    Joined:
    Nov 3, 2012
    Messages:
    25
    Likes Received:
    0
    What do you suggest me to protect my batch file? I've bought a professional software to compile bat and cmd but it decompiles the source to the %temp% folder.

    The ideas were to run the batch on the web or encrypt the batch and run it locally, so yesterday i've installed TCC but i don't know if it can encrypt my batch or help me in some way. I've created a GUI (with an authoring software) called "loader.exe" to launch my batch file. I can modify "loader.exe" to can pass any parameters to my batch, for example:

    Could it useful (a parameter) to encrypt my batch?
    Could TCC help me?

    Thank you very much
     
  6. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    Have you look into BATCOMP?
     
  7. aedthuio

    Joined:
    Nov 3, 2012
    Messages:
    25
    Likes Received:
    0
    EDIT:

    Tried now to encrypt my batch with BATCOMP. How can i launch the encrypted file to test it?
     
  8. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    The same way your run any batch file: type its filename at the command prompt.
     
  9. aedthuio

    Joined:
    Nov 3, 2012
    Messages:
    25
    Likes Received:
    0
    I try to explain me better:

    This is "mybatch.cmd":



    With batcomp i do:

    Batcomp has now created the "myencryptedbatch.cmd" file. Editing it, i found something like this:

    How can i run the "myencryptedbatch.cmd" batch file?
     
  10. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    Change to the directory it's in, and type MYENCRYPTEDBATCH.
     
  11. aedthuio

    Joined:
    Nov 3, 2012
    Messages:
    25
    Likes Received:
    0
    I've opened "tcc.exe" and after changing the batch dir i type: myencryptedbatch

    tcc.exe says that is an unknown command.
     
  12. aedthuio

    Joined:
    Nov 3, 2012
    Messages:
    25
    Likes Received:
    0
    What is the command to decrypt an encrypted batch? In the Help i can only find the batcomp to encrypt.
     
  13. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    649
    Likes Received:
    1
    The page "Batch File Compression" says, "JP Software does not provide a utility to decompress batch files. If you use BATCOMP, make sure that you also keep a copy of the original batch file for future inspection or modification."

    Compressing a .cmd file doesn't work for me either. It works for .btm.
     
  14. aedthuio

    Joined:
    Nov 3, 2012
    Messages:
    25
    Likes Received:
    0
    Ok, it works!
     
  15. aedthuio

    Joined:
    Nov 3, 2012
    Messages:
    25
    Likes Received:
    0
    Does exist a way to read the source of a .btm encrypted file? Is it secure?
     
  16. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    I don't think it's cryptographically secure, but it's certainly a lot more obscure than a CMD.EXE batch file -- which must be in plain text for CMD.EXE to process it.
     
  17. aedthuio

    Joined:
    Nov 3, 2012
    Messages:
    25
    Likes Received:
    0
    Thank you!

    Now i've tried to encrypt a big size batch file (over 80kb). It contains several FOR / commands.

    It seems that the new encrypted .btm is too long. It gives an error about a label that can't found.

    If i cut some FOR commands it works. There are no errors in this batch, infact cmd.exe runs it fine.
     
  18. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,040
    Likes Received:
    84
    BATCOMP is a somewhat obsolete and elderly (originally in 4DOS) command; batch files are limited to a maximum size of 64K before compression. If you need to use BATCOMP, you'll have to break up your batch file into multiple < 64K files.
     

Share This Page