Use autorun to call batch file & return to autorun

vandyo

n00b
Joined
May 19, 2012
Messages
2
have installed family history app on usb that i want to run on various PCs.I have an autorun that calls batch file that copies a usb drive mgr to the HD & executes it. This keeps usb drive letters to xyz. Problem is that cannot get the batch to return to the autorun and do the code to to start the menu to allow me to bring the family history app up. Both batch and
autorun work if each are separated and run by themselves. Code is listed below:

[Autorun]
@echo off
open=_begin.bat
action=start _begin
Open=CDMENU2.exe
Action=Start CDMENU2
Label=My Family
Icon=CDMENU2.exe

(_Begin.bat)
@echo off
xcopy "%~dp0USBDLM" "C:\USBDLM\"
xcopy "%~dp0shortcuts" "C:\"
SET PATH=C:\USBDLM\
call _install.cmd

I have begun to think my problem is that one can't return to an autorun like you can a batch file, so thought to add the batch at the end of the autorun but this creates a problem for me with the drive letter as the drive mgr is not yet loaded. Any help appreciated.
 
The autorun isn't designed for what you want to do. You'll have to make your own executable, or make something in the batch file to do what you want to do.

One trick you could possibly use is the %~dp0 variable. This will return the path where the batch file is executed from. If your software is running from the usb drive, you could run it without caring what the drive letters were. Not sure if that will help or not.

Other than that, you are going to have to keep looping until the drive is available and then do what you've got to do. Maybe something like this:

Code:
:CheckForDrive
  Echo Checking For Drive
  If not exist E:\ goto :CheckForDrive 
  Echo Drive Found

Depending on the complexity, you might even want to look into a vbscript to get this task done.
 
Thanks for the suggestions Demon. I will check to see if help I've already started collecting info on vb scripts, but will have to hold off for awhile as will be tied up for about the next 5-6 wks I live in Florida and have been having sinkhole activity & will be pressing the insurance co. Just for your info, it's not about drive avail. as this software I load with the batch file locks my USB drives to U_V_W_Y_Z., & no problem grabbing the U always. All this used to be fairly simple when I got interested about 30 years ago. Now it's really difficult wrapping my brain around all this again. Again, thanks for the reply. If joy is found I will post it here.
 
Back
Top