If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Now you see how we use to make installation batch files Who needs a setup program when you can batch the entire thing. I'll look for the utility, it's in my archive of floppies somewhere. You can take batch files and convert them to *.com files which is like "compiling" it so to speak but not exact. This will provide the same functions, but in binary form so people can't just edit the file and steal your code, err batch of commands

Good post Negative :-)
Maybe you answer a question thats been bothering me for a while...
When using command lines for scripting, you sometimes need to set a variable %Rootdrive% to be a users home directory, but, knowing that batch files are not able to use 2 variables as a piece of data - and the home directory is a combination of server name and home directory name, its necessary to use Subst command to consolidate the two variables (Subst %RootDrive% %HomeDrive% %HomePath%) - Now, maybe i'm being stupid but do we not use 2 variables to create the consolidated value - because we can't use 2 variables!!!
Hope you can shed some light on this for me, i can't seem to get my head round it!

Batch to Exec

Ok, here is the program. It was a freeware thing released 11 years ago, ok don't laugh at me, I'm not that old, anyway it was cool then and it's cool now

Here is how it works (sorry lost the documentation long ago)

Take your batch file, we will call this example foo.bat

It does something useful, cool, maybe looks like a password login or something. You want to make it an exec file so people can just open up notepad and steal your hard work, heh.

Put the bat2exec.com on your hard drive somewhere, doesn't matter where (temp directory would be a good idea). Copy the batch file into the same directory. Simply type the program name, a space, and the batch file name and it will make one with the *.com extention.

bat2exec foo.bat

==> becomes foo.com

Foo.bat and Foo.com do the exact same thing except now it's an exec file. This was useful for making password prompts out of batch files, but you didn't want someone to just edit the file and see what the password was. This was useful decades ago

Im' not sure what you mean with your question, but about the batch-file variables: you actually can use up to 9 variables when it comes to batch-filing (%1 to %9). %0 has a special meaning: it's the batch file's name.

This is what I think you mean: you need to set the environment variable Rootdrive (%rootdrive%), and that variable consists of (the variables) %Homedrive% and %Homepath%. You indeed can't (as far as I know) consolidate those two variables using a batch-file.

But u can use the parameters of a batchfile.
Let's say you want the environment variable to be the consolidation of the first parameter + the second parameter of your batchfile (test.bat):

@echo off
cls
set rootdrive=%1%2

For example, if your input is test c:\ user (with a space between c:\ and user), this batchfile will set rootdrive to "c:\user" (one string, no space between c:\ and user).

Now, let's say you have %homedrive%, and %homepath% (two environment variables), and you want to 'consolidate' them into one environment variable (%rootdrive%). This is like the opposite of the former example...
So, typing set at the prompt would give you something like homedrive=c:\
homepath=user

--- Test.bat --

@echo off
cls
rem Write the output of set to check.bat
set >check.bat
rem Retrieve the homedrive setting (/i for no distinction between rem caps and lower-cases) in check.bat and write them to
rem home.bat. < is used to avoid the -------check.bat the FIND
rem command generates.
find /i "homedrive" <check.bat>home.bat
rem Do the same for homepath, add it to home.bat
find /i "homepath" <check.bat>>home.bat

Now we have a home.bat-file containing the following:
homedrive=c:\
homepath=user

Now, we need those two values combined in one string "c:\user" and we need it to be set as the %rootdrive% variable.

And that is where I'm stuck . If you just can tell me whether I'm going in the right direction or not...
If yes, I'll try to work it out later...
If not, well... too bad