batch file starts in wrong directory on drag and drop

G

Guest

I have a batch file on my desktop called batch.bat. Here are the contents:

echo %1
pause

If I drag and drop a file onto the icon, here are the results:

C:\WINDOWS\Fonts>echo "C:\Program Files\mIRC\servers.ini"
"C:\Program Files\mIRC\servers.ini"

C:\WINDOWS\Fonts>pause
Press any key to continue . . .

Why is the batch file starting in C:\WINDOWS\Fonts? If I click on it or run
it from CMD, it starts from the desktop as it should. What gives?
 
R

Ramesh, MS-MVP

Interesting problem! Type this in Start, Run:

CMD /C SET >C:\ENV.TXT

Open C:\ENV.TXT using Notepad and post the contents here.

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows XP Shell/User]
Windows® XP Troubleshooting http://www.winhelponline.com


I have a batch file on my desktop called batch.bat. Here are the contents:

echo %1
pause

If I drag and drop a file onto the icon, here are the results:

C:\WINDOWS\Fonts>echo "C:\Program Files\mIRC\servers.ini"
"C:\Program Files\mIRC\servers.ini"

C:\WINDOWS\Fonts>pause
Press any key to continue . . .

Why is the batch file starting in C:\WINDOWS\Fonts? If I click on it or run
it from CMD, it starts from the desktop as it should. What gives?
 
G

Guest

ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\*****\Application Data
CLIENTNAME=Console
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=*****
ComSpec=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\*****
LOGONSERVER=\\*****
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 3 Stepping 3, GenuineIntel
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0303
ProgramFiles=C:\Program Files
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\*****\LOCALS~1\Temp
TMP=C:\DOCUME~1\*****\LOCALS~1\Temp
USERDOMAIN=*****
USERNAME=*****
USERPROFILE=C:\Documents and Settings\*****
windir=C:\WINDOWS

Doesn't look like there's anything useful in there. *shrug*
 
R

Ramesh, MS-MVP

No references to Fonts folder anywhere in that log.
May be checking the .BAT file association gives a clue?
(Ref : http://windowsxp.mvps.org/fileextinfo.htm)

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows XP Shell/User]
Windows® XP Troubleshooting http://www.winhelponline.com


ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\*****\Application Data
CLIENTNAME=Console
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=*****
ComSpec=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\*****
LOGONSERVER=\\*****
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
 
G

Guest

[HKEY_CLASSES_ROOT\.BAT]
@="batfile"

[HKEY_CLASSES_ROOT\.BAT\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"


[HKEY_CLASSES_ROOT\batfile]
@="MS-DOS Batch File"
"EditFlags"=hex:30,04,00,00

[HKEY_CLASSES_ROOT\batfile\DefaultIcon]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,00,68,00,\
65,00,6c,00,6c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,31,00,35,\
00,33,00,00,00

[HKEY_CLASSES_ROOT\batfile\shell]

[HKEY_CLASSES_ROOT\batfile\shell\edit]

[HKEY_CLASSES_ROOT\batfile\shell\edit\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
00

[HKEY_CLASSES_ROOT\batfile\shell\open]
"EditFlags"=hex:00,00,00,00

[HKEY_CLASSES_ROOT\batfile\shell\open\command]
@="\"%1\" %*"

[HKEY_CLASSES_ROOT\batfile\shell\print]

[HKEY_CLASSES_ROOT\batfile\shell\print\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,2f,00,70,00,20,\
00,25,00,31,00,00,00

[HKEY_CLASSES_ROOT\batfile\shellex]

[HKEY_CLASSES_ROOT\batfile\shellex\DropHandler]
@="{86C86720-42A0-1069-A2E8-08002B30309D}"

[HKEY_CLASSES_ROOT\batfile\shellex\PropertySheetHandlers]

[HKEY_CLASSES_ROOT\batfile\shellex\PropertySheetHandlers\PifProps]
@="{86F19A00-42A0-1069-A2E9-08002B30309D}"

[HKEY_CLASSES_ROOT\batfile\shellex\PropertySheetHandlers\ShimLayer Property
Page]
@="{513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}"
 
R

Ramesh, MS-MVP

Everything looks OK, no idea what's causing this problem :(
Will post back if I find anything interesting!

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows XP Shell/User]
Windows® XP Troubleshooting http://www.winhelponline.com


[HKEY_CLASSES_ROOT\.BAT]
@="batfile"

[HKEY_CLASSES_ROOT\.BAT\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
 
G

Guest

You might have an invalid value as Cmd.exe default path:

Open Start, Run, type 'regedit' without quotation marks and click OK. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor key and make sure that the AutoRun value is blank. Then check the HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor key and repeat the above steps if you find there an 'AutoRun' value. Close Registry Editor and restart the computer.
 
R

Ramesh, MS-MVP

Good idea, Daniel. I thought of that. But as the OP says "If I click on it
or run it from CMD, it starts from the desktop as it should", I ruled out
that idea.

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows XP Shell/User]
Windows® XP Troubleshooting http://www.winhelponline.com


You might have an invalid value as Cmd.exe default path:

Open Start, Run, type 'regedit' without quotation marks and click OK. Go to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor key and make sure
that the AutoRun value is blank. Then check the
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor key and repeat the
above steps if you find there an 'AutoRun' value. Close Registry Editor and
restart the computer.
 
G

Guest

Thanks for trying to help me diagnose this problem but it's fixed now.
Rebooting fixed it :p I know what you're going to say: it's Windows and I
should have tried rebooting in the first place, but I'm used to running
FreeBSD and the only time I reboot is to makeworld when a new version comes
out or now with Windows XP, on update Tuesday. Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top