Is there a way to maintain the original file association when running a program from a batch file?
I created a batch file that calls a Windows program and performs some file maintenance. I changed the file association to the batch file. When I click on a file that's associated with that program, the batch file executes and opens the program but the file I click on isn't loaded. The original file association is lost.
This sorta makes sense because the CALL command within the batch file is once removed from the initial mouse-click that initiated the batch file.
Is there a syntax I can add that would pass the target file name to the batch file as a variable and append it to the CALL command line?
BTW, this is for an XP machine. Any assistance would be appreciated!
EDIT: here's the code I'm trying to write:
call "C:\Program Files\CorelDRAW X4\Programs\CorelDRW.exe"
:loop
if exist "C:\Documents and Settings\<user>\My Documents\corel user files\*.cdr" copy "C:\Documents and Settings\<user>\My Documents\corel user files\*.cdr" "C:\Documents and Settings\<user>\My Documents\corel user files\*.sav"
ping localhost -n 300 > nul
goto loop
I'm trying to protect CorelDraw's auto-save file. There's a bug whereby CorelDraw sometimes deletes the auto-save file during abnormal shut-down. I changed the .cdr file association so that clicking on a cdr file calls the batch file, which in turn calls Coreldraw and copies the auto-save file to a different filename. That part works, but I have to manually open the file I clicked on.
Ideally, I'd like to figure out a way to terminate the loop when I close CorelDraw, but I'll cross that bridge once I solve the file association problem.
EDIT2: Here is the result of echo %CMDCMDLINE%
:
C:\WINDOWS\system32\cmd.exe /c ""C:\Documents and Settings\<user>\My Documents\corel user files\protect_autosave.bat" "C:\Documents and Settings\<user>\My Documents\filename.cdr""