How to chose folder in .bat files while install from CD

Status
Not open for further replies.
Hi to all,

I read some excellent reply in this forum which give me the hope to ask for help. I want to modify a .bat file and burn it to a DVD that can install the game to hard drive but will ask for to chose a drive. I don't want it to be installed always to c drive and don't want to copy it to a drive and then install. The code I have that can install the game where the folder is and then delet the setup files.
After lots of reading I know how to use the code to copy from DVD to c drive and then delet setup files. But now I want to go one step advance which is chosing a dive in .bat setup. I know there are some option code which have to be written in 1,2,3 format, but I don't know how to convert that to chose drive..

I am posting the code that i have, which install the game in same folder, run regedit and delet the setup files.

@echo off
cls
title GAME
cd main
cls
7z x models.7z
del models.7z
cls
7z x main.7z
del main.7z
cls
7z x the_rest.7z
del the_rest.7z
del 7z.exe
cd ..
7z x the_rest.7z
del the_rest.7z
del 7z.exe
cls
regedit setup.reg
cls

Pls help to me with the rest.
 
I used get.exe (I attached it) and then put it in the same folder as my batch file.
And then put a line saying:
get c "Enter a Drive: " ABCDEFGHIJKLMNOPQRSTUVWXYZ /a241 /vdrive

but I was using a virtual drive at the time (years ago) And now I can't remember everything. Anyway I tested the line, it does still work.

Here's lots more info to read
http://www.ahuka.com/dos/index.html
.
 
In WIndows 2000 and newer you ask for user input like this:
Code:
SET /P DIRECTORY="Enter the destination directory: "
CD %DIRECTORY%
blah 
blah
blah
Or
Code:
SET /P DRIVE="Enter the destination drive: "
%DRIVE%
blah
blah blah
You get the idea
 
Thank u guys for ur quick reply. I will try as u two said and post my result asap.
I think that might help as well someone like me in later..
 
sorry guys i couldn't make it work. both method were asking for the drive but not making any folder in the drive.
can u pls show/ write the code for me that will creat a folder as entered (eg. x: SOF) and will extract the out puts from cd to that folder.
Is it possiable ?
 
Some games have ini files in them like setup.ini that can be modified to point to a new location, some have switches like /? that can be used to modify certain setup proceedures.

But most Games do have some files requiring to be installed on C drive (ie DirectX and driver installs, sound files and a number of other user files)
So therefore it depends on the game, ie a standalone game will work easily (just using Xcopy and possibly running some automatic registry entry (I've done that)

On that you could find where all the files are being installed to, then copy every file (already extracted) to your CD, then use xcopy and MD and copy commands to put them in your own unique folder (depending on if the game allows run from a different location or not)

Maybe start with a simple >1meg game then slowly learn how to do the bigger ones. (knowing that not all games will work this way anyway)
 
If you want someone to provide the exact code, then you have totell us exactly what you want..

The following asks for a pathname, creates it and changes directory to the newly created folder.
Code:
SET /P DESTPATH="Enter the destination path: "
MKDIR %DESTPATH%
CD /D %DESTPATH%
 
Thank you again guys for your reply. I didn't get get chance to try as Nodsu said till today.
It is creating folder in the chosen drive but not extracting the content there. My code is like this --

@echo off
cls
title TEST 1
SET /P DESTPATH="Enter the destination path: "
MKDIR %DESTPATH%
CD /D %DESTPATH%
cd Folder One
cls
7z x File one.7z
cls
cd ..
7z x File two.7z
cls

Now i want to extract these files and folders in the way they are build, in chosen destination. My cd drive could be anything but A,B,C,D.

How can i do that ? I am using mentioned code. You can add or delet anything there that will be enough for me to understand. Thanks in advance.
 
doesn't 7zip have these dos commands, or even WinRar. Please search on Google for these switches.

Also you could set temp=%temp% and extract to C:\DOCUME~1\WINDOW~1\LOCALS~1\Temp, and then xcopy and copy, the files directly from there directly to their location.

Actually I had a program once that was a program builder (not exactly Bat) it created a MSI personal install program that you could do anything with. Umm it was a long time ago and I've forgotten the name! (try MSI builder or something like that!) But again, this was not a batch file.
 
Nemo: "not" means what? What errors do you get? Run the command prompt (cmd) first and then the bat file inside that to see what is going on.

I hope your batch file is not exactly like you posted, because I see at least three glaring issues there:
The plain command "7z" works only if the path to 7zip install is in the PATH variable, or the 7zip executable is in the current directory.
Same for the file you are extracting. If you specify only the file name, then the file has to be in the current directory for 7zipto be able to extract it.
Any file names containing spaces have to be quoted.
 
I tried the code in my E drive and able to make folder in F drive with my provided name. But nothing was extracted to F drive folder, all extracted in E drive and in bat folder where the original file is. Then I tried by making an image file and mount form a virtual drive. Then it made a folder in chosen drive and closed the prompt, nothing else happen. My folder names are different in the original FILE and I have a 7zip.exe file in the same folder which I got from another file (i wasn't able to find out how to make that exe file). But anyway that exe file is doing its jobs by extracting it in the same folder.
I don't know this exe file is made to extract only its own folder or not.
 
Status
Not open for further replies.
Back