What is GBXfer?
GBXfer is a script that makes it possible to transfer games to real diskettes straight from the GameBase frontend.
All you have to do is select the game of your choice and click Transfer to real disk. That's all!
The game will be converted to a format supported by OpenCBM and transferred to a 5.25" disk without any user intervention.
Who should use GBXfer?
If you use the GameBase frontend with a collection of Commodore 64 software (for example GameBase64 or IntroBase64), you have to play all games in an emulator.
For anyone who wants to keep a huge collection of Commodore 64 software well organized, but likes to run that software on original hardware, GBXfer can automate a lot of work.
How can GBXfer help making things easier?
Transferring a game from a GameBase collection is quite complicated. Suppose you want to play the game Pitstop on your Commodore 64. It's easy to find in the GameBase frontend, but you don't have it on a 5.25" floppy. Then this is what you normally need to do:
- Find the location of the .zip file containing the game you want to play. This seems not very hard to do, but remember that the GameBase64 collection contains 21000 .zip files.
- Once the .zip file you're looking for is found, you have to extract it somewhere to your harddisk.
- Most games are stored in .t64 format. This is a file type that is not supported by OpenCBM, so you need to convert it to something OpenCBM can handle, like .prg or .d64. You need an external tool like DirMaster to accomplish this.
- When you have converted the file to an OpenCBM supported format, you have to transfer the file to disk. You can do this by using the command prompt and type the appropriate OpenCBM command, or use a GUI to do this. You have to browse to the folder containing your to .prg or .d64 converted game and click the transfer button.
Everything - finding, extracting, converting, transferring with/without using the CBMXfer GUI - is done without any user intervantion. So all you have to do is click and wait for the transfer to complete!
I use a previous version of GBXfer. What's changed?
- This version can be used with both GameBase V1.2 and the new GameBase V1.3 frontend. The previous version had some GameBase V1.2 specific settings and does not work with GameBase V1.3.
- When using GameBase V1.3, the GUI behaviour can be set more easy than in the previous version. To enable/disable the CBMXfer GUI, you had to make a (small) change in the GEMUS script. When using GameBase V1.3, you can set this by defining a Global key=value pair.
- Split up long lines in GBXfer.cmd into multiple parts.
- Limited support for .g64 files. If one or more .g64 files are found, they are converted to .d64 before handing over to OpenCBM or CBMXfer. Only .g64 files without copy protection will run on original hardware, because some information is lost during the .g64 to .d64 converion.
Requirements
- A Windows PC (2000/XP/Vista/7) with the GameBase frontend and a collection of Commodore 64 programs.
- The OpenCBM driver must be installed and must work correctly. The OpenCBM command cbmctrl status should return 00, ok,00,00.
- GBXfer uses some files from external programs. Certain files from these programs are needed for GBXfer to work properly:
1. WinVICE
2. OpenCBM
3. CBMXfer
4. mnib
Collect the files you need
First you have to find the Emulators folder that GameBase uses. This folder contains subfolders for CCS64 and WinVICE, maybe more.
Download the package with the files you need from here and extract it to this Emulators folder.
FYI: the package contains the following files:
- From the OpenCBM package: CBMCOPY.EXE, CBMCTRL.EXE, D64COPY.EXE, CBMFORMAT.EXE and CBMFORNG.EXE
- From the WinVICE package: C1541.EXE
- From the CBMXfer package: CBMXFER.EXE, TOKENS.DAT and 6502OPCODES.TXT
- From the mnib package: G2D.EXE
- A text file with the name GBXFER.CMD. You can find the contents of this file at the end of this text.
- A text file with the name GBXFER_SCRIPT.TXT. You can find the contents of this file below.
- CBMCOPY.EXE
CBMCTRL.EXE
D64COPY.EXE
CBMFORMAT.EXE
CBMFORNG.EXE
TOKENS.DAT
6502OPCODES.TXT
C1541.EXE
CBMXFER.EXE
GBXFER.CMD
GBXFER_SCRIPT.TXT
G2D.EXE
Integrate GBXfer with GameBase
After copying the required files to the correct location in step 1, we can configure GameBase to use the GBXfer script.
To do this, start GameBase. Click on GEMUS in the Menu bar and click Manage Emulators...
Click the left button to create a new 'emulator'. The 'Emulator Properties' window is displayed. Fill in the following things:
- Under 'Emulator Name': Transfer to real disk
- Under 'Emulator Path\Filename': Browse to the file GBXfer.cmd you copied in step 1. Don't forget to set the File Types to Batch files when browsing to GBXfer.cmd. When Emulators (*.exe) is selected, you will not see .cmd files.
- Click to unselect 'Use Defaults'. You can now enter the file types in the text box below it. Type: d64;t64;prg in this text box.
- Click to select 'Use Short (8.3) Filenames'.
- Remove the 2 lines in the script window and paste the the contents of the text file GBXFER_SCRIPT.TXT (see below) in it.
- Click OK and give the script the name GBXfer.
How to use GBXfer
You can transfer almost all games from GameBase the following way:
- Right click the 'Play game' button
- Click 'Transfer to real disk'
- One or 2 questions are asked. The first question is if you want to use the GUI for transfer. If you click Yes, all game image files are converted to a format that OpenCBM can handle, copied to a temporary location and the CBMXfer is started, so you can transfer the game with a single mouseclick.
If you choose No, the image(s) is/are transfered directly to disk without any user intervention! - In some cases a second question is displayed. When you have selected a game for transfer, stored on a single D64 image, you are asked if you want to write the complete D64 image to disk, or just the PRG files inside that D64 image.
If you have selected a D64 image that contains 1 or 2 PRG files, select No. If you are going to transfer a disk that is (almost) full or contains a lot of files, Yes is the best choice.
You can change the behaviour of GBXfer a little bit.
Every time you start a transfer, you are asked if you want to use the GUI. If you always use the same method (in other words always use the GUI or never use the GUI), you can skip this question. There is a difference in how to do this between GameBase V1.2 and GameBase V1.3. Follow the instructions for the GameBase version you use.
- I'm using GameBase V1.2
You can change this by making a small change in the GEMUS script.
To do this, in GameBase click GEMUS, then click Transfer to real disk and scroll down to the last part of the script. You see a line 'PLEASE READ THIS INFORMATION'. Under the comments there are 3 lines that begin with an If statement. 2 of them start with a semicolon ( ; ). By adding and removing semicolons in these 3 lines, you can change the behaviour of using the GUI. - I'm using GameBase V1.3
In GameBase version 1.3 it's much easier to change the behaviour of GBXfer regarding using the GUI for file transfers.
GameBase V1.3 has a new feature called Global Key=Value pairs which you can use for this. In GameBase V1.3, press F2. A new window named GEMUS "key=value" pairs pops up. In the right pane, in the big text box under <GLOBAL>, type USECBMXFER=YES, USECBMXFER=NO or USECBMXFER=ASK. Click OK and Yes to save. When set to Yes, CBMXfer is always used for transfers. The CBMXfer GUI is never used when set to No. If the key=value pair USECBMXFER does not exist or has another value, every time you transfer a program you will get a question if you want to use the GUI.
GBXFer_Script.txt
Code: Select all
;*******************************************************
;* GEMUS Script for transferring games to real disks
;* (c) K.C.
;* November 2010
;*******************************************************
;==============================================================================
; PLEASE SET YOUR EMULATOR PROPERTIES AS FOLLOWS:
;
; Emulator File : GBXfer.cmd
; Associated Script File (1) :
; Use Short Filenames : YES
; File Types : D64;PRG;T64;G64
;
;==============================================================================
;
; This script needs the following files:
; From the OpenCBM Package:
; CBMCOPY.EXE, CBMCTRL.EXE, D64COPY.EXE, CBMFORMAT.EXE, CBMFORNG.EXE
; From the CBMXfer Package:
; CBMXFER.EXE, TOKENS.DAT, 6502OPCODES.TXT
; From the WinVICE Package:
; C1541.EXE
; From the mnib package:
; G2D.EXE
; Copy these files to the same folder as GBXfer.cmd
;
;==============================================================================
;
; TO SET THE BEHAVIOUR OF THE CBMXFER GUI
;
; Using GameBase 1.2: Read the instructions in the last part of this script
;
; Using GameBase 1.3: Set a Global K=V pair USECBMXFER to Yes, No or Ask
;
;==============================================================================
If GameType CONTAINS(d64||prg||t64||g64)
;--------------------------------
;give the user a warning message?
;--------------------------------
If VersionComment CONTAINS(*not 100%*||*not working*||doesn't work*)
Show_Message(This game may not work properly.)
End If
If VersionComment CONTAINS(*ATTN:*||*NOTE:*||*ATTN!:*||*NOTE!:*)
;point out that critical info is in the version comment
Show_Message(Read this game's Version Comments for very important information/instructions.)
End If
If GameType CONTAINS(g64)
Show_Message(This is a G64 disk image.%crlfx2%Transfer will only be successful if the disk image contains software without copy protection.)
End If
;-------------------------
;show message for the user
;-------------------------
If Key_msg CONTAINS(*)
Show_Message(%msg_value%)
End If
;---------------------------------
;pass Game path to transfer script
;---------------------------------
Add_CLP( %gamepath%)
;---------------------------------------------------------
;Set default path of CBMXfer to path containing disk image
;---------------------------------------------------------
Set_CFG_Value(%emupath%\CBMXfer.ini||SourcePath||%gamepath%\Xfer\)
Set_CFG_Value(%emupath%\CBMXfer.ini||DestPath||c:\)
Set_CFG_Value(%emupath%\CBMXfer.ini||DriveNum||8)
Set_CFG_Value(%emupath%\CBMXfer.ini||NoWarpString|| )
Set_CFG_Value(%emupath%\CBMXfer.ini||TransferString||auto)
Set_CFG_Value(%emupath%\CBMXfer.ini||AutoRefreshDir||1)
Set_CFG_Value(%emupath%\CBMXfer.ini||PreviewCheck||0)
Set_CFG_Value(%emupath%\CBMXfer.ini||ShowCMD||0)
Set_CFG_Value(%emupath%\CBMXfer.ini||ConfirmD64||1)
Set_CFG_Value(%emupath%\CBMXfer.ini||DestMode||0)
Set_CFG_Value(%emupath%\CBMXfer.ini||LinkCStr||serial 19200,com1)
Set_CFG_Value(%emupath%\CBMXfer.ini||ConfirmD64||1)
Set_CFG_Value(%emupath%\CBMXfer.ini||EnableX||1)
Set_CFG_Value(%emupath%\CBMXfer.ini||EnableLink||0)
Set_CFG_Value(%emupath%\CBMXfer.ini||UseVice||False)
Set_CFG_Value(%emupath%\CBMXfer.ini||VicePath|| )
;-----------------------------------------------------------
;Determine the version of the GameBase frontend (1.2 or 1.3)
;-----------------------------------------------------------
If %dbdriveletter% CONTAINS(a||b||c||d||e||f||g||h||i||j||k||l||m||n||o||p||q||r||s||t||u||v||w||x||y||z)
;------------------------------------------
;Check if user wants to use the CBMXFer GUI
;------------------------------------------
If Key_UseCBMXfer CONTAINS(n||*no*||false||off||0)
Add_CLP( 0)
;--------------------------------------------------
;choose between single prg or complete d64 transfer
;--------------------------------------------------
If NumGameFiles > 1
Add_CLP( 1)
Else
If GameType CONTAINS(d64)
If QUESTION(Do you want to transfer the COMPLETE D64 image?%crlfx2%ATTENTION: Contents of disk will be destroyed when choosing YES! ) = YES
Add_CLP( 1)
Else
Add_CLP( 0)
End If
Else
If GameType CONTAINS(g64)
Add_CLP( 1)
Else
Add_CLP( 0)
End If
End If
End If
Else
If Key_UseCBMXfer CONTAINS(y||*yes*||true||on||1)
Add_CLP( 1 0)
Else
;------------------------------
;ask for using GUI for transfer
;------------------------------
If QUESTION(Do you want to use the GUI for file transfer?) = YES
Add_CLP( 1 0)
Else
Add_CLP( 0)
;--------------------------------------------------
;choose between single prg or complete d64 transfer
;--------------------------------------------------
If NumGameFiles > 1
Add_CLP( 1)
Else
If GameType CONTAINS(d64)
If QUESTION(Do you want to transfer the COMPLETE D64 image?%crlfx2%ATTENTION: Contents of disk will be destroyed when choosing YES! ) = YES
Add_CLP( 1)
Else
Add_CLP( 0)
End If
Else
If GameType CONTAINS(g64)
Add_CLP( 1)
Else
Add_CLP( 0)
End If
End If
End If
End If
End If
End If
Else
;------------------------------
;ask for using GUI for transfer
;------------------------------
;**************************************************************************
;* PLEASE READ THIS INFORMATION *
;* ============================ *
;*
;* Right under this comment are 3 lines, beginning with the If statement.
;* Only ONE of these lines must NOT start with a semicolon (;).
;*
;* When the line "If NumGameFiles = 0" does NOT start with a semicolon,
;* GEMUS will NEVER use the GUI and start immediately with the transfer.
;*
;* When the line "If NumGameFiles != 0" does NOT start with a semicolon,
;* GEMUS will ALWAYS use the GUI for file and disk transfers.
;*
;* When the line starting with "If QUESTION" does NOT start with a
;* semicolon, GEMUS will ask you if you want to use the GUI everytime you
;* start a game.
;**************************************************************************
;If NumGameFiles = 0
;If NumGameFiles != 0
If QUESTION(Do you want to use the GUI for file transfer?) = YES
Add_CLP( 1 0)
Else
Add_CLP( 0)
;--------------------------------------------------
;choose between single prg or complete d64 transfer
;--------------------------------------------------
If NumGameFiles > 1
Add_CLP( 1)
Else
If GameType CONTAINS(d64)
If QUESTION(Do you want to transfer the COMPLETE D64 image?%crlfx2%ATTENTION: Contents of disk will be destroyed when choosing YES! ) = YES
Add_CLP( 1)
Else
Add_CLP( 0)
End If
Else
Add_CLP( 0)
End If
End If
End If
End If
;------------
;run emulator
;------------
Run_Emulator()
Else
;invalid game file type
Show_Message(GAME_NOT_SUPPORTED%crlfx2%Supported types: D64, PRG, T64)
End If
Code: Select all
@Echo off
Rem ----------------------------------------------
Rem Script for transferring program files from the
Rem GameBase frontend to a real Commodore disk
Rem
Rem Version 3.1, Created November 2010 by K.C.
Rem ----------------------------------------------
Rem -----------------------------------------------------------------------
Rem Command Line Parameters:
Rem %1 = Location of GBGame folder (Default C:\GBGame)
Rem %2 = Flag for starting GUI
Rem %3 = Flag for using File copy (CBMCOPY) or D64 transfer (D64COPY)
Rem -----------------------------------------------------------------------
Rem --------------------------------------------------------------------
Rem Do several checks to see if script is started from GameBase frontend
Rem --------------------------------------------------------------------
If %1X==X Goto NoParam
If %2X==X Goto NoParam
If %3X==X Goto NoParam
Goto Check1
:NoParam
Echo.
Echo WARNING!
Echo ========
Echo This script is intended to be used from the GameBase frontend.
Echo 3 paramters are required, one or more are missing.
Echo Further execution is terminated.
Pause
Goto End
:Check1
If Exist %1\. Goto Check2
Echo.
Echo WARNING!
Echo ========
Echo This script is intended to be used from the GameBase frontend.
Echo %1 is an incorrect path for the GameBase image.
Echo The first parameter should point to the folder where Gamebase
Echo extracts the image to, default path is C:\GBGame
Pause
Goto End
:Check2
If %2X==0X Goto Check3
If %2X==1X Goto Check3
Echo.
Echo WARNING!
Echo ========
Echo This script is intended to be used from the GameBase frontend.
Echo Incorrect second parameter (%2): can only be 0 or 1.
Echo This parameter determines if the transfer script will launch
Echo the GUI for transfers (1) or not (0).
Pause
Goto End
:Check3
If %3X==0X Goto StartGBXfer
If %3X==1X Goto StartGBXfer
Echo.
Echo WARNING!
Echo ========
Echo This script is intended to be used from the GameBase frontend.
Echo Incorrect third parameter (%3): can only be 0 or 1.
Echo When transferring a single D64 image, this parameter
Echo determines if the transfer script will perform
Echo a file copy to the disk with the OpenCBM CBMCOPY command (0)
Echo or transfers the complete D64 image to the disk with
Echo the OpenCBM D64COPY command (1)
Pause
Goto End
:StartGBXfer
Rem ---------------------------------------------
Rem If not exist, create temporary working folder
Rem and eventually delete files from it
Rem ---------------------------------------------
If Not Exist "%1\SrcImg\." MD "%1\SrcImg"
For %%A in (%1\SrcImg\*.*) Do Del "%%A" > NUL
Rem --------------------------------------------------
Rem If not exist, create temporary folder for transfer
Rem and eventually delete files from it
Rem --------------------------------------------------
If Not Exist %1\XFER\. MD %1\XFER
If Exist %1\XFER\*.PRG DEL %1\XFER\*.PRG
If Exist %1\XFER\*.T64 DEL %1\XFER\*.T64
If Exist %1\XFER\*.D64 DEL %1\XFER\*.D64
If Exist %1\XFER\*.G64 DEL %1\XFER\*.G64
Rem -----------------------------------
Rem Find images in the Game folder
Rem and copy them to the working folder
Rem -----------------------------------
For %%A in (%1\*.*) Do Copy "%%A" "%1\SrcImg" > NUL
Rem ---------------------------------------
Rem If G64 files exist, convert them to D64
Rem ---------------------------------------
for %%A in (%1\SrcImg\*.G64) do copy "%%A" "%%A.G64"^
&& del "%%A"^
&& g2d "%%A.G64" > NUL
Rem ------------------------------------------
Rem Launch GUI if this was the choice in GEMUS
Rem ------------------------------------------
If %2==1 Goto UseGUI
Rem ------------------------------------------------------------
Rem Check to see if there are any D64 files in the GBGame folder
Rem If not, skip to the section for transferring T64 images
Rem ------------------------------------------------------------
If Not Exist %1\SrcImg\*.D64 Goto CheckT64
Rem -----------------------------------------------------------
Rem Set environment variable to wait for keystroke in next step
Rem -----------------------------------------------------------
Set AskKey=Y
Rem ------------------------------------------------
Rem Copy all D64 images to the temporary XFER folder
Rem ------------------------------------------------
For %%A In (%1\SrcImg\*.D64) Do Copy "%%A" "%1\XFER" > NUL
Rem ----------------------------------
Rem Reset bus before starting transfer
Rem ----------------------------------
Echo Resetting IEC Bus...
CBMCTRL.EXE reset
Echo.
Echo C1541 status:
CBMCTRL.EXE status 8
Rem -----------------------------------------------
Rem If this was the choice in GEMUS, start transfer
Rem of complete D64 images with D64COPY command
Rem -----------------------------------------------
If %3==1 For %%A In (%1\XFER\*.D64) Do Echo Insert a new disk in drive 8^
&& Echo WARNING!!! Contents of this disk will be destroyed!^
&& Pause && Echo Formatting disk...^
&& CBMFORNG.EXE 8 gbxfer,64 && Echo.^
&& Echo Transferring disk image %%A && D64COPY.EXE "%%A" 8 && Echo.
Rem -----------------------------------------------------------------
Rem If D64COPY was the choice in GEMUS, Skip file copy from D64 image
Rem and jump to the section for transferring T64 images
Rem -----------------------------------------------------------------
If %3==1 Goto CheckT64
Rem ----------------------------------------------------------
Rem Create temporary folder to extract PRG's from D64 image to
Rem ----------------------------------------------------------
If Not Exist XFERTEMP\. MD XFERTEMP
CD XFERTEMP
Rem --------------------------------------------------
Rem Extract PRG's from D64 image to temporary folder
Rem --------------------------------------------------
Echo Extracting PRG's from D64 Image...
FOR %%A IN (%1\XFER\*.D64) DO ..\C1541.EXE -attach "%%A" -extract > NUL
Rem ---------------------------------------------------------
Rem Copy all PRG's from temporary folder to real disk in 1541
Rem ---------------------------------------------------------
For %%A IN (*.*) Do ..\CBMCOPY.EXE -w 8 "%%A"
Rem --------------------------------------------------
Rem Delete extracted PRG's and delete temporary folder
Rem --------------------------------------------------
CD ..
For %%A In (XFERTEMP\*.*) Do Del "%%A"
RD XFERTEMP
:CheckT64
Rem ------------------------------------------------------------
Rem Check to see if there are any T64 files in the GBGame folder
Rem If not, skip to the section for transferring PRG images
Rem ------------------------------------------------------------
If Not Exist %1\SrcImg\*.T64 Goto CheckPRG
Rem ------------------------------------------------
Rem Copy all T64 images to the temporary XFER folder
Rem ------------------------------------------------
For %%A In (%1\SrcImg\*.T64) Do Copy "%%A" "%1\XFER" > NUL
Rem ----------------------------------------------------------------------
Rem Wait for keystroke if images of another format are already transferred
Rem ----------------------------------------------------------------------
If %AskKey%es==Yes Echo Press any key for transferring T64 image && Pause
Rem ----------------------------------
Rem Reset bus before starting transfer
Rem ----------------------------------
Echo Resetting IEC Bus...
CBMCTRL.EXE reset
Echo.
Echo C1541 status:
CBMCTRL.EXE status 8
Rem ------------------------------------------
Rem Start file transfer from T64 image to disk
Rem ------------------------------------------
For %%A IN (%1\XFER\*.T64) Do CBMCOPY.EXE -w 8 "%%A"
Rem -----------------------------------------------------------
Rem Set environment variable to wait for keystroke in next step
Rem -----------------------------------------------------------
Set AskKey=Y
:CheckPRG
Rem ------------------------------------------------------------
Rem Check to see if there are any PRG files in the GBGame folder
Rem If not, skip to the end of this script
Rem ------------------------------------------------------------
If Not Exist %1\SrcImg\*.PRG Goto End
Rem ----------------------------------------------------------------------
Rem Wait for keystroke if images of another format are already transferred
Rem ----------------------------------------------------------------------
If %AskKey%es==Yes Echo Press any key for transferring PRG image && Pause
Rem ------------------------------------------------
Rem Copy all PRG images to the temporary XFER folder
Rem ------------------------------------------------
For %%A In (%1\SrcImg\*.PRG) Do Copy "%%A" "%1\XFER" > NUL
Rem ----------------------------------
Rem Reset bus before starting transfer
Rem ----------------------------------
Echo Resetting IEC Bus...
CBMCTRL.EXE reset
Echo.
Echo C1541 status:
CBMCTRL.EXE status 8
Rem ------------------------------------------
Rem Start file transfer from PRG image to disk
Rem ------------------------------------------
For %%A IN (%1\XFER\*.PRG) Do CBMCOPY.EXE -w 8 "%%A"
Goto End
:UseGUI
Rem ------------------------------------------
Rem Convert T64 images to D64 and copy PRG and
Rem D64 images to temporary folder
Rem ------------------------------------------
For %%A In (%1\SrcImg\*.PRG) Do Copy "%%A" "%1\XFER" > NUL
For %%A In (%1\SrcImg\*.D64) Do Copy "%%A" "%1\XFER" > NUL
If Not Exist %1\SrcImg\*.T64 Goto StartGUI
Rem ----------------------------------------------------------
Rem Create temporary folder to extract PRG's from T64 image to
Rem ----------------------------------------------------------
If Not Exist XFERTEMP\. MD XFERTEMP
CD XFERTEMP
Rem -----------------------------------
Rem Copy T64 images to temporary folder
Rem -----------------------------------
Copy %1\SrcImg\*.T64 . > NUL
Rem ---------------------------------------------
Rem For each T64 image, create a blank D64 image,
Rem copy the files inside the T64 image to it and
Rem copy the D64 image to the XFER folder
Rem ---------------------------------------------
For %%A in (*.T64) Do ..\C1541.EXE -format gbxfer,64 d64 "%%A.D64" > NUL^
&& ..\C1541 "%%A.D64" -tape "%%A" > NUL^
&& Copy "%%A.D64" %1\XFER > NUL && DEL "%%A.D64" > NUL
Rem ---------------------------------------------------
Rem Delete copied T64 images and remove XFERTEMP folder
Rem ---------------------------------------------------
CD ..
Del XFERTEMP\*.T64
RD XFERTEMP
:StartGUI
Rem ---------------------------------
Rem Cleanup and delete working folder
Rem ---------------------------------
If Exist %1\SrcImg\. for %%A in (%1\SrcImg\*.*) Do Del "%%A"
If Exist %1\SrcImg\. RD "%1\SrcImg"
Rem --------------
Rem Launch the GUI
Rem --------------
CBMXFER
Goto End
:End
Rem ----------------------------------------
Rem Cleanup and delete temporary XFER folder
Rem ----------------------------------------
If Exist %1\XFER\. for %%A in (%1\XFER\*.*) Do Del "%%A"
If Exist %1\XFER\. RD "%1\XFER"
Rem ---------------------------------
Rem Cleanup and delete working folder
Rem ---------------------------------
If Exist %1\SrcImg\. for %%A in (%1\SrcImg\*.*) Do Del "%%A"
If Exist %1\SrcImg\. RD "%1\SrcImg"
Rem ------------------------------------
Rem Clear temporary environment variable
Rem ------------------------------------
Set AskKey=