Page 1 of 1

Share some batch files!

Posted: Tue Jun 09, 2009 11:46 am
by Harry Potter
The fiollowing batch file installs a program in ZIPped format on a RAM drive, runs it, then removes it from the RAM drive. It assumes that the RAM drive is drive D: and the files are stored in C:\RAMP. It also assumes you're using PKZIP for compression. If your setup is different, you need to alter the file. Give the ZIP file the name of the main executable in the program and provide it to the batch file. It shouldn't work on a batch file. It's untested.

Code: Select all

@echo off
md d:\%1
cd d:\%1
d:
pkunzip -d c:\ramd\%1.zip
%1
d:
cd\
echo y|deltree %1
Try it out! I will add more batch files later.

Posted: Tue Jun 09, 2009 11:57 am
by Harry Potter
Here's a second bath file for WinNT. It packs a program project in the current directory for distribution to drive A:. It looks for a file with the extension .zzz and names the distribution file with the same name but a .ZIP extension. You can substitute the extension in the second line and the compression program in the third line. If necessary, you can add to or change the files to compress in the third line and copy it to the fourth line.

Code: Select all

@echo off
for %%i in (*.zzz) do set p=%%~ni.zip
pkzip -ex -r -p a:\%p% *.bas *.frm *.bat *.lib *.qlb *.mak
set p=

Posted: Tue Jun 09, 2009 4:01 pm
by Anonymous
A text adventure written with two batch files

http://www.geocities.com/sitenixon/textad.zip

Posted: Thu Jun 11, 2009 12:38 am
by bongomeno
wow an IF game!!

Posted: Thu Jun 11, 2009 6:45 am
by qbasicfreak
the game is cool...
I've never tried making games with batch files!

qbasicfreak

Email search script

Posted: Wed Jun 17, 2009 11:20 am
by RichardWilliams
Good idea about posting scripts that people find useful.

I find script http://www.biterscripting.com/SS_FindEmailStrs.html useful. I can search all my emails for one, two, or more, keywords, phrases, from/to, etc.

Richard

Posted: Sun Jun 21, 2009 5:32 am
by Anonymous
This outputs the dir information to FileDir.txt which I then access to find out what files are in a folder in my qb programs.

SHELL("DIR > FileDir.txt")

Posted: Sun Jul 19, 2009 4:48 am
by jasbales
I can hear crickets up in here, what's going on? Let's keep this place going. I know you're all still around...

I have a batch file I use to insert SUBs and FUNCTIONs into code as I work on it in Programmer's Notepad. Here's the code for the BATCH

Code: Select all

@ECHO OFF
:About
::      O--------------------------------------------------------------O
::      |subShop.bat helps you create QB SUBs and FUNCTIONs in Crimson |
::      |           Editor. Pass in your source file as %1.            |
::      |                                                              |
::      |            This file was created by Jason Bales              |
::      |                   gamerplusplus@gmail.com                    |
::      |                 http://gamerpp.blogspot.com/                 |
::      O--------------------------------------------------------------O

CLS
SETLOCAL
PROMPT
COLOR 47
TITLE WELCOME TO THE SUB SHOP!!

:: Are we to make a Sub or a Function?
SET /p subOrFunction="Are we to make a Sub or a Function?: "
CLS

:: What is the name of the Sub or Function?
SET /p name="What will we call it?: "
CLS

:: What are we passing in?
SET /p parameters="What are we passing in?: "

:: Simple choice
IF %subOrFunction% == SUB GOTO SUB
IF %subOrFunction% == sub GOTO SUB
IF %subOrFunction% == Sub GOTO SUB
IF %subOrFunction% == SUb GOTO SUB
IF %subOrFunction% == suB GOTO SUB
IF %subOrFunction% == sUB GOTO SUB
IF %subOrFunction% == sUb GOTO SUB

REM Notice you only need to type SUB if you want a SUB.
REM Any other input creates a FUNCTION.

:: Write a FUNCTION
> SCRATCH.TXT ECHO DECLARE FUNCTION %name% (%parameters%)
>>SCRATCH.TXT TYPE %1
>>SCRATCH.TXT ECHO.
>>SCRATCH.TXT ECHO ' ____________________
>>SCRATCH.TXT ECHO FUNCTION %name% (%parameters%)
>>SCRATCH.TXT ECHO    ' Write your code here
>>SCRATCH.TXT ECHO %name% = ' Make sure the function returns something
>>SCRATCH.TXT ECHO END FUNCTION

> %1 TYPE SCRATCH.TXT
GOTO FIN

:: Write a SUB
:SUB
> SCRATCH.TXT ECHO DECLARE SUB %name% (%parameters%)
>>SCRATCH.TXT TYPE %1
>>SCRATCH.TXT ECHO.
>>SCRATCH.TXT ECHO ' ____________________
>>SCRATCH.TXT ECHO SUB %name% (%parameters%)
>>SCRATCH.TXT ECHO    ' Write your code here
>>SCRATCH.TXT ECHO END SUB

> %1 TYPE SCRATCH.TXT

:FIN
DEL SCRATCH.TXT
ENDLOCAL
I use this file along with a PN tool like I describe in this article:
http://gamerpp.blogspot.com/2009/07/add ... in-pn.html

If you see something that could be improved, please let me know.

Posted: Mon Jul 20, 2009 10:39 am
by Harry Potter
I have a batch file I use to insert SUBs and FUNCTIONs into code as I work on it in Programmer's Notepad.
That's a good idea! :) BTW, where can I download PN?

Posted: Mon Jul 20, 2009 12:04 pm
by jasbales
Thanks.

PN is here:
http://www.pnotepad.org/

and the other tutorials are in PDF here:
http://sites.google.com/site/qb45lives/ ... -tutorials

Posted: Mon Jul 20, 2009 5:10 pm
by burger2227
I thought the entire idea of Qbasic was to advance past DOS batch files?
QB makes it easy to create SUB programs already!

I used BATs a lot in Win 3.1, but later decided I'd rather really program.

I guess it is still fun to try it the hard way.......

Posted: Mon Jul 20, 2009 5:49 pm
by jasbales
Burger,
You're right, but in my defense, most of the programming and scripting stuff I do is really "just because". I'm still tinkering with QB even though there are a hundred better options. My laptop has some issues with the QB IDE's menus and the IDE also doesn't like the touchpad, so I use a different text editor a lot of the time. I could probably insert SUBs all day long in the QB environment on another computer, but for now this BAT is the shizz. I did make a couple QB tools that are EXEs. One is made with QB and the other with VB6, but if a quick BAT will do the job, that's probably what I'll use. I like the BATs and I like QB. If I were into newer, "easier" stuff I'd probably be on a different website.

Posted: Mon Jul 20, 2009 6:38 pm
by burger2227
I once found a program to convert BAT to EXE files. It might still be on my 98 machine.