Share some batch files!

Discuss whatever you want here--both QB and non-QB related. Anything from the DEF INT command to the meaning of life!

Moderators: Pete, Mods

Post Reply
Harry Potter
Veteran
Posts: 111
Joined: Sat Feb 21, 2009 8:19 am
Location: New York, U.S.

Share some batch files!

Post by Harry Potter » Tue Jun 09, 2009 11:46 am

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.
Joseph Rose, a.k.a. Harry Potter
Creating magic in the computer community...or at least striving to! :(

Harry Potter
Veteran
Posts: 111
Joined: Sat Feb 21, 2009 8:19 am
Location: New York, U.S.

Post by Harry Potter » Tue Jun 09, 2009 11:57 am

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=
Joseph Rose, a.k.a. Harry Potter
Creating magic in the computer community...or at least striving to! :(

Anonymous

Post by Anonymous » Tue Jun 09, 2009 4:01 pm

A text adventure written with two batch files

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

User avatar
bongomeno
Veteran
Posts: 231
Joined: Wed Dec 10, 2008 9:08 am
Location: San Bernardino CA
Contact:

Post by bongomeno » Thu Jun 11, 2009 12:38 am

wow an IF game!!
Home: http://www.geekbasic.com" target="_blank
Forum: http://www.geekbasic.com/index.gbws?$page=forumsmain" target="_blank
QB64 powered web server: http://www.geekbasic.com/index.gbws?$pa ... inter=%201" target="_blank

User avatar
qbasicfreak
Veteran
Posts: 90
Joined: Wed Oct 22, 2008 3:27 pm
Location: canada

Post by qbasicfreak » Thu Jun 11, 2009 6:45 am

the game is cool...
I've never tried making games with batch files!

qbasicfreak

RichardWilliams
Newbie
Posts: 1
Joined: Wed Jun 17, 2009 11:14 am

Email search script

Post by RichardWilliams » Wed Jun 17, 2009 11:20 am

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

Anonymous

Post by Anonymous » Sun Jun 21, 2009 5:32 am

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")

jasbales
Coder
Posts: 17
Joined: Mon Nov 22, 2004 11:36 am
Location: Prescott AZ
Contact:

Post by jasbales » Sun Jul 19, 2009 4:48 am

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.

Harry Potter
Veteran
Posts: 111
Joined: Sat Feb 21, 2009 8:19 am
Location: New York, U.S.

Post by Harry Potter » Mon Jul 20, 2009 10:39 am

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?
Joseph Rose, a.k.a. Harry Potter
Creating magic in the computer community...or at least striving to! :(

jasbales
Coder
Posts: 17
Joined: Mon Nov 22, 2004 11:36 am
Location: Prescott AZ
Contact:

Post by jasbales » Mon Jul 20, 2009 12:04 pm

Thanks.

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

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

User avatar
burger2227
Veteran
Posts: 2425
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Mon Jul 20, 2009 5:10 pm

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.......
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

jasbales
Coder
Posts: 17
Joined: Mon Nov 22, 2004 11:36 am
Location: Prescott AZ
Contact:

Post by jasbales » Mon Jul 20, 2009 5:49 pm

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.

User avatar
burger2227
Veteran
Posts: 2425
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Mon Jul 20, 2009 6:38 pm

I once found a program to convert BAT to EXE files. It might still be on my 98 machine.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

Post Reply