How to pass filename from Windows to DOS? - TechRepublic
Question
June 5, 2008 at 09:45 AM
ahmad

How to pass filename from Windows to DOS?

by ahmad . Updated 18 years, 1 month ago

Hi,

Is there anyway to pass a selected filename to DOS shell. Following scenario will explain the question better.

A person right clicks on a file (let’s say abc.txt) in Windows Explorer and clicks on “Mark Reviewed” (as an example). It should open Dos shell (cmd.exe) and executes “move abc.txt C:\Reviewed\”

I can add “Mark Reviewed” to the context menu using registry and also open cmd.exe but once DOS shell is open I do not know which file was selected.

I implemented similar for Folders and that works but I could not figure our for Files. Below is the script for Folders.

**********SCRIPT BEGINS****************

cd %1
cd > %temp%\TEMPdir.txt
FOR /F “delims=” %%a in (%temp%\TEMPdir.txt) do set foldertomove=%%a
del %temp%\TEMPdir.txt
move “%foldertomove%” C:\Reviewed

********SCRIPT ENDS******************

Any suggestions?

Ahmad

This discussion is locked

All Comments