Bob wrote:
> On 4/19/2013 9:58 AM, foxidrive wrote:
>> On 19/04/2013 11:53 PM, Todd Vargo wrote:
>>> On 4/18/2013 8:03 PM, Robert Baer wrote:
>>>> Auric__ wrote:
>>>>> Robert Baer wrote:
>>>>>
>>>>>> "REMDIR /S FOLDERNAME" works at console prompt, but in a batchfile i
>>>>>> get the error message "invalid switch -/S".
>
>> Another question: do you have a RMDIR.BAT or .CMD file on your machine?
> Greetings foxidrive,
>
> I thought you might be on to something with the name and extension of
> the file so I decided I'd see if I could reproduce the OP's error. I
> created the OP's folder list and then went to remove the folders.
> That's when the fun started :)
>
> I tried four batch files named: rd.bat, rd.cmd, rmdir.bat and rmdir.cmd.
>
> When I double click any of the above named batch files it proceeds as
> usual. However, if I type rd or rmdir from a command prompt the
> batch file fails; adding the extension e.g. rd.bat, the file proceeds.
>
> (Tested using both WIN7 and Virtual XP)
>
> ::Start Screen Capture from a command prompt
> C:\Test>dir /b
> 14584
> ct3290973
> MagicISO_01CE3036170751A0
> mozilla-media-cache
> msoclip1
> msohtml
> msohtml1
> plugtmp
> plugtmp-1
> plugtmp-2
> rmdir.bat
> TempThumbDir
> VBE
> {A0931C37-2FA5-44D7-9B46-C84D15D266F7}
>
> C:\Test>rmdir
> The syntax of the command is incorrect.
>
> C:\Test>rmdir.bat
> 14584, Are you sure (Y/N)? n
> ct3290973, Are you sure (Y/N)? n
> MagicISO_01CE3036170751A0, Are you sure (Y/N)? n
> mozilla-media-cache, Are you sure (Y/N)?
>
> ::End Screen Capture from a command prompt
> <And so forth until end of the folder list>
>
> Here's the batch file I used.
>
> ::FILE NAME RMDIR.BAT
> ::Remove folders
> RMDIR /S 14584
> RMDIR /S ct3290973
> RMDIR /S MagicISO_01CE3036170751A0
> RMDIR /S mozilla-media-cache
> RMDIR /S msoclip1
> RMDIR /S msohtml
> RMDIR /S msohtml1
> RMDIR /S plugtmp
> RMDIR /S plugtmp-1
> RMDIR /S plugtmp-2
> RMDIR /S TempThumbDir
> RMDIR /S VBE
> RMDIR /S {A0931C37-2FA5-44D7-9B46-C84D15D266F7}
> Pause
>
> See any flaws in my test?
>
>
YES!
You incorrectly used a command name for the filename.
Note that C:\Test>rmdir bitched about syntax, and that is correct, in
that the command rmdir expects arguments and there are none.
The only way a improperly named BAT or CMD file can be forced to
execute is to use the fill filename and filetype.