cmd line %1 not working

Gigabyte / Nvdaacpi
September 5, 2009 at 14:39:07
Specs: Microsoft Windows Vista Ultimate, 2 GHz / 3070 MB
(It's **** near impossible to search for this since "%" is ignored in almost all
search engines... )
I'm trying to use the very common "Print directory listing" context menu batch file in
Vista. However, %1 is not returning the directory I am selecting. I tested this by just
trying to echo or cd %1 and I just get blank output - if I put quotes around "%1", I
only get quotes (for echo). %0 still works and shows the batch file name, but no
parameters after that (1,2,3,4...) have any output (just says "echo is on"). Help?
Weird huh?

I have already added the shell command key for directories in the registry

Here's the test batch:

echo %1
dir %1 /-p /o:gn >"%temp%\Listing.txt"
start /w notepad "%temp%\Listing.txt"
del "%temp%\Listing.txt"

BTW, sfc, AVG, and Mbam didn't find any problems. I'm running Vista Ult.SP1.

edited by moderator: language

See More: cmd line %1 not working

Report •

September 5, 2009 at 16:04:30
What does your HKEY_CLASSES_ROOT\Directory\shell\Print Directory Listing\command\(default) registry entry look like?

Report •

September 5, 2009 at 20:55:03
default value is "Printdir.bat" (I have the batch file in c:\windows ).

Report •

September 5, 2009 at 21:47:17
Try changing it to:
"%systemroot%\printdir.bat" "%1"

Report •

Related Solutions

September 8, 2009 at 07:32:39
Ahah! That didn't quite work... gave me an error about not having
permission to access the specified folder - even on in my own
user directory. But I did find what works...

"Printdir.bat" "%1"

Thank you for your time and effort and hopefully this will help
someone else out.

Report •

Ask Question