Help with DOS - TechRepublic
Question
July 3, 2008 at 07:42 AM
ahmad

Help with DOS

by ahmad . Updated 18 years ago

Can someone help me what could possibly be wrong with following script.

——————————-
cd %1

cd > C:\TEMPFILE.TXT

FindStr “HSP” C:\TEMPFILE.TXT > C:\TEMPFILE.TXT

FOR /F “delims=” %%a in (C:\TEMPFILE.TXT) do set HSPFlag=%%a

del C:\TEMPFILE.TXT

if NOT %HSPFlag%==”” (dir >> C:\TEMPFILE.TXT)

if EXIST C:\DestinationFolder\NUL && EXIST C:\TEMPFILE.TXT (move %1 “C:\DestinationFolder”)

del C:\TEMPFILE.TXT
———————————

In Windows Explorer Context Menu, I have added a command “Reviewed” by making changes in registry. The command will call a batch file which will have above script.

Here is what I am trying to achieve. When a person right clicks on a folder and chooses “Reviewed” from the context menu, the selected folder should move to “DestinationFolder” if selected folder’s path contains “HSP”

Above script is not working most likely because of some error in IF statements.

Any help would be greatly appreciated.

This discussion is locked

All Comments