CMD Batch Online

Nov 3, 2012
25
0
#1
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
 
Sep 11, 2012
82
1
#2
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:[email protected]/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
 
Nov 3, 2012
25
0
#3
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?
 
Nov 3, 2012
25
0
#5
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:

Run("C:\mycompiledbatch.exe","/C /parameter")
Could it useful (a parameter) to encrypt my batch?
Could TCC help me?

Thank you very much
 
Nov 3, 2012
25
0
#9
I try to explain me better:

This is "mybatch.cmd":


@echo off
echo TEST OK
>nul pause
exit

With batcomp i do:

batcomp /E /O mybatch.cmd myencryptedbatch.cmd
Batcomp has now created the "myencryptedbatch.cmd" file. Editing it, i found something like this:

»$鑬뛆羬阝韂겺ᆘ邢쇳敾揞᧼查ခꣲ땂⍣粌䠋଱郗쓚㴬戀謉뮞
How can i run the "myencryptedbatch.cmd" batch file?
 
#13
What is the command to decrypt an encrypted batch? In the Help i can only find the batcomp to encrypt.
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.
 
Nov 3, 2012
25
0
#17
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.
 

rconn

Administrator
Staff member
May 14, 2008
10,582
97
#18
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.
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.