1.

Solve : need code to open the drive where the originating exe or autorun.inf is ran..????

Answer»

im making a batch file that im turning into a .exe with "Quick Batch File Complier"
this .exe along with a Autorun.inf will be auto copied to the root of every drive my PC has access to, by means of another lil app i made that CONSTANTLY runs in the background searching for new drives to copy these 2 files to.
-------------------------------------------------
the Autorun.INF code is this

[autorun]
UseAutoPlay=1
Action=View Files On Device
shellexecute=Autorun.exe

--------------------------------------------------
The Batch-Autorun.exe code is this

START -DRIVE that this .EXE is ran from- code that i need help with..!!!
START %MYFILES%\virus-scan.exe

--------------------------------------------------
so when the drive is double clicked on that these 2 files are in the root of, the root of the drive will be opened in a new explorer window and then my portable Virus-Scanner executes.

but I need some code for either the batch-exe file or the Autorun.inf file to open the drive where this originating exe is ran from.
i know it works when i assign a drive letter to the batch code like START F:\
but i WANT it to open the drive that this EXE is ran from no matter what the drive letter is that the device its on is assigned.
IS this possible at all or not.
Thanx for anyones help...
When a batch file is being run, the variable %0 holds the full path and file name of that batch file. It roughly means "my own path and name" as far as the batch file is concerned.

It is possible to extract, from a path and filename, just the drive letter by using the ~d qualifier, so that %~d0 (by the way that's a zero, not a letter O) expands to 2 characters: (1) the drive letter (2) a colon. ( : ) Add a backslash ( \ ) and you're good to go.

So if a batch file was on a CD-ROM in drive F, when the command START %~d0\ was PROCESSED, the variable would expand to F:\ and that drive would be opened in Windows Explorer.

This works ABSOLUTELY FINE in a normal XP command file. If it works in Gee-Whiz Batch Compiler I do not know. As you might guess, I don't like batch compilers.









Discussion

No Comment Found