Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Flaky DOS (CMD ) batch "operation"

116 views
Skip to first unread message

Robert Baer

unread,
Apr 18, 2013, 4:21:39 PM4/18/13
to
"REMDIR /S FOLDERNAME" works at console prompt, but in a batchfile i
get the error message "invalid switch -/S".
WTF?

Frank Westlake

unread,
Apr 18, 2013, 5:28:51 PM4/18/13
to
2013-04-18 13:21, Robert Baer:
> "REMDIR /S FOLDERNAME" works at console prompt, but in a batchfile i
> get the error message "invalid switch -/S".

REMDIR is not a Windows command -- perhaps you should look in a Linux
group for help. Run this:

WHERE REMDIR

Frank

Auric__

unread,
Apr 18, 2013, 5:35:05 PM4/18/13
to
Assuming you mean rmdir, it works for me, batch file or otherwise. What
version of Windows, and what's your entire batch look like?

--
- And knowing is half the battle!
- Then what's the other half?

Bob

unread,
Apr 18, 2013, 5:41:37 PM4/18/13
to
On 4/18/2013 4:21 PM, Robert Baer wrote:
> "REMDIR /S FOLDERNAME" works at console prompt, but in a batchfile i
> get the error message "invalid switch -/S".

Greetings Robert,
REMDIR is used to remove a directory on a remote machine using FTP. Did
you mean to type RMDIR?

Robert Baer

unread,
Apr 18, 2013, 7:57:08 PM4/18/13
to
Sorry, i misspelled it, s/b RMDIR.

Robert Baer

unread,
Apr 18, 2013, 8:00:57 PM4/18/13
to
Yes; i made an error in typing.

Robert Baer

unread,
Apr 18, 2013, 8:03:08 PM4/18/13
to
Auric__ wrote:
> Robert Baer wrote:
>
>> "REMDIR /S FOLDERNAME" works at console prompt, but in a batchfile i
>> get the error message "invalid switch -/S".
>> WTF?
>
> Assuming you mean rmdir, it works for me, batch file or otherwise. What
> version of Windows, and what's your entire batch look like?
>
OS is Win2K pro; file is:
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}

Auric__

unread,
Apr 18, 2013, 7:48:10 PM4/18/13
to
Well, that works for me on my Win2k install.

Are you just looking to clear your temp directory? If so, this should work:

rd /s %TEMP%
md %TEMP%

Or this, from within %TEMP%:

for /d %x in (*) do rd /s /q "%x"

(Double the percent signs for within a batch, of course; %%x instead of %x.)

--
In Heaven an angel is nobody in particular.
-- George Bernard Shaw

Todd Vargo

unread,
Apr 19, 2013, 9:53:35 AM4/19/13
to
Does each line throw the error message, or only one in particular?

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

foxidrive

unread,
Apr 19, 2013, 9:58:24 AM4/19/13
to
Another question: do you have a RMDIR.BAT or .CMD file on your machine?

--
foxi

Robert Baer

unread,
Apr 19, 2013, 2:10:04 PM4/19/13
to
Obviously, they all act the same as each one is independent of any
previous command.
I type one at the CMD prompt and it executes perfectly without
complaints, but in a BAT file, i get the "invalid switch - /S" message.

Herbert Kleebauer

unread,
Apr 19, 2013, 1:33:45 PM4/19/13
to
On 19.04.2013 20:10, Robert Baer wrote:

>>> OS is Win2K pro; file is:
>>> RMDIR /S 14584

> I type one at the CMD prompt and it executes perfectly without
> complaints, but in a BAT file, i get the "invalid switch - /S" message.

Is it 32 bit Win2k? Maybe you execute the batch with command.com instead
of cmd.exe.



Auric__

unread,
Apr 19, 2013, 5:23:56 PM4/19/13
to
Win2k was only made for 32-bit x86 machines. (Only version of NT made for a
single processor family.)

--
- It's not?
- No!
- Oh, huzzah.

Todd Vargo

unread,
Apr 19, 2013, 10:25:53 PM4/19/13
to
Obviously, we are playing 20 questions to identify the problem.

7. When it works at the prompt, are you using CMD.EXE or COMMAND.COM?

8. Have you tried both to verify it works on both?

We need to know how you are executing this "BAT file" too.

9. From the same prompt where it works manually, or by double clicking
the file in Explorer?

10. What extension does your "BAT file" have? (.BAT or .CMD)?

Note, this should help identify the problem but further questions may
still be needed.

Bob

unread,
Apr 20, 2013, 12:39:58 AM4/20/13
to
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?


foxidrive

unread,
Apr 20, 2013, 12:57:16 AM4/20/13
to
On 20/04/2013 2:39 PM, Bob wrote:
> 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?

It's possible that there is another RMDIR.BAT/CMD on the path, and the behaviour would depend on the
content of the file. That's the line that I was suggesting...


--
foxi

Bob

unread,
Apr 20, 2013, 1:06:02 AM4/20/13
to
On 4/20/2013 12:39 AM, 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".

> See any flaws in my test?

I see a flaw. I need move c:\test\rmdir.bat to
c:\ and then run it on the c:\test\folders
with a fully qualified path.


Robert Baer

unread,
Apr 20, 2013, 2:53:25 AM4/20/13
to
That is exactly what i thought..

Robert Baer

unread,
Apr 20, 2013, 2:59:09 AM4/20/13
to
* AFAIK there is NO choice, the icon is CMD, not MSDOS like one sees in
Win98SE.

>
> 8. Have you tried both to verify it works on both?
* With no choice,,,

>
> We need to know how you are executing this "BAT file" too.
* This is stupid...in the CMD window, i type the name of the BAT
file,which in this case is POO.BAT so i type POO.

>
> 9. From the same prompt where it works manually, or by double clicking
> the file in Explorer?
* Like i said above, i type POO.

>
> 10. What extension does your "BAT file" have? (.BAT or .CMD)?
* DAMN! Did i or did i not say BAT?????????

>
> Note, this should help identify the problem but further questions may
> still be needed.
>
*
Just exercise a little sanity,please.

Robert Baer

unread,
Apr 20, 2013, 3:07:15 AM4/20/13
to
What i see as "wrong" is giving a BAT file the same name as a
(system) command.
Umpteen years ago before even Win3.11, trying such foolishness caused
all kinds of problems, and i learned the hard way to NEVER do that.
Please do not ask what the problems were as that was more than two
days ago and i have a short memory.

Retry with listed contents in files like DEW.BAT and WET.CMD (again,
*DIFFERENT* filenames so they cannot conflict).
I will give this a try and report back later.

Robert Baer

unread,
Apr 20, 2013, 3:08:38 AM4/20/13
to
NEVER use a filename the same as a system command; you are asking for
troubles in river city.

foxidrive

unread,
Apr 20, 2013, 2:12:56 AM4/20/13
to
On 20/04/2013 4:59 PM, Robert Baer wrote:

> Just exercise a little sanity,please.

It's *your* problem, that you can't solve in 2 minutes of trying a few tests.
You now post here and poo-poo people who are trying to figure out what you have done.

Yes, you could have been using command.com and the question had to be asked, because you didn't say.
It matters how you launch a batch file - and you didn't say.
You have a choice in typing command or cmd at a command prompt. Guess what? You didn't say.


It *is* a game of 20 questions. You haven't answered my question yet.



--
foxi

Bob

unread,
Apr 20, 2013, 3:02:52 AM4/20/13
to
On 4/20/2013 1:06 AM, Bob wrote:
> On 4/20/2013 12:39 AM, 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".

> I see a flaw. I need move c:\test\rmdir.bat to
> c:\ and then run it on the c:\test\folders
> with a fully qualified path.
Note to self:
After reading additional posts obviously you have
spent too much time poo pooing with this thread.

Done.



foxidrive

unread,
Apr 20, 2013, 4:10:28 AM4/20/13
to
On 20/04/2013 5:08 PM, Robert Baer wrote:
> foxidrive wrote:
>> It's possible that there is another RMDIR.BAT/CMD on the path, and the behaviour would depend on the
>> content of the file. That's the line that I was suggesting...
>>
> NEVER use a filename the same as a system command; you are asking for
> troubles in river city.

Yet again, you did not rule out that possibility in your first post - so it had to be asked.

19 questions left.



--
foxi

foxidrive

unread,
Apr 20, 2013, 4:31:15 AM4/20/13
to
Here Bob is right. An internal command will take precedence over a batch file, and the bat file needs to
have 'rmdir.bat' used to launch it.


Robert, you state that this works in a cmd prompt but it doesn't work in a .bat file.

rmdir /s folder



what does this produce:

echo %comspec%



--
foxi

Frank Westlake

unread,
Apr 20, 2013, 7:17:36 AM4/20/13
to
2013-04-19 23:59, Robert Baer:
> Just exercise a little sanity,please.

Have patience Robert, this is a frequent problem and we don't know your
experience.

The behavior you describe suggests that there is a file somewhere in the
path of your script with the name RMDIR and a file name extension listed
in the variable "PATHEXT". Add these lines to the script and compare the
output with the same lines run from the command line:

WHERE RMDIR
PATH
RMDIR /?

If you find the problem then please write back so that we can also
learn. If it was a stupid mistake then you are permitted to not write
back because we will assume then that it was only a stupid mistake.

Frank

Robert Baer

unread,
Apr 21, 2013, 12:37:28 AM4/21/13
to
G:\WINNT\system32\cmd.exe

Like i said, there is NO command.COM - it ain't an option.

Todd Vargo

unread,
Apr 20, 2013, 11:59:23 PM4/20/13
to
You are frustrated with the problem but your condescending lashing out
at the help is counter productive. I know that you have been around
umpteen years so it was reasonable to assume that you were aware that
Win2k Pro has two command line interpreters, CMD.EXE and COMMAND.COM but
may not know that each one operates slightly different from the other. I
don't have a copy of Win2k available to me to see if RMDIR has /S
available in both.

Unfortunately, from the responses that you have provided above, you
don't even know which CLI you have open. If you want a little sanity,
try answering peoples questions with a positive attitude and intelligent
information and we will see if they lead to a solution.

Robert Baer

unread,
Apr 21, 2013, 1:14:07 AM4/21/13
to
Ages ago i used to know how to turn on copy of all what one sees on
the screen / console and then turn that off, so..
Took a screen shot, but this NG interface refuses anything with an
attachment.
"WHERE" is not recognized.
"RMDIR /?" gives exactly what it is supposed to.. /S Removes all
directories in the specified directory in addition to the directory itself.
And the syntax is RMDIR [/S] [/Q] [drive:]path

foxidrive

unread,
Apr 21, 2013, 12:24:09 AM4/21/13
to
On 21/04/2013 3:14 PM, Robert Baer wrote:

> Ages ago i used to know how to turn on copy of all what one sees on
> the screen / console and then turn that off, so..

In later windows you right click the title bar and click edit and then mark. Mark the text and right
click places it in the clipboard.

It could be the same in W2K.

> "RMDIR /?" gives exactly what it is supposed to.. /S Removes all
> directories in the specified directory in addition to the directory itself.
> And the syntax is RMDIR [/S] [/Q] [drive:]path

If you install Teamviewer or similar and trust someone to have a look at your system remotely - moving
the mouse and operating the keyboard which watching your screen - then it could be a good way to get a
solution.

Teamviewer has a user number and a temporary password which changes to give to a helper - so it's very
useful for remote access - and there is no need to install it, you can use it as a once-off tool by
launching it and choosing the immediate non-install mode.



--
foxi

Robert Baer

unread,
Apr 21, 2013, 1:54:39 AM4/21/13
to
Let me pete again (re-pete).
At the CMD window, (again: CMD window) what i said in a BAT file
(POO.BAT) DOES NOT WORK, the /S causes the RMDIR command to barf.
Furthermore RMDIR /? shows the full expected command with /S and /Q.
Now,at the console, it works when you type in EXACTLY what was in the
BAT file.
It should be obvious that the CLI is CMD.EXE, and not a non-available
"command.com".

So...if there is a way to use "command.com", lemme know and also how
to make it a (temporary) default (and switch back).


Tom Del Rosso

unread,
Apr 21, 2013, 1:27:03 AM4/21/13
to
Command.com certainly comes in Win2k.

Put echo %comspec% at the top of the batch and see what it prints.

Change the file extension from bat to cmd. It should still run. When you
use commands that don't work pre-NT, you should use cmd to prevent them from
being run in Win95 or DOS, or a command.com window. Using the bat extension
in any version of NT is like asking for trouble in Grand Rapids, Brisbane,
or Hiroshima, and if you follow that convention the question wouldn't come
up.


--

Reply in group, but if emailing remove the last word.


Tom Del Rosso

unread,
Apr 21, 2013, 1:36:14 AM4/21/13
to

Robert Baer wrote:
>
> So...if there is a way to use "command.com", lemme know and also how
> to make it a (temporary) default (and switch back).

By typing command of course.

Herbert Kleebauer

unread,
Apr 21, 2013, 4:05:11 AM4/21/13
to
On 21.04.2013 07:54, Robert Baer wrote:

> At the CMD window, (again: CMD window) what i said in a BAT file
> (POO.BAT) DOES NOT WORK, the /S causes the RMDIR command to barf.

Seems you are not the first one with this problem:

http://en.community.dell.com/support-forums/software-os/f/3524/p/17030438/17153424.aspx#17153424


1. check whether cmd.exe is corrupted (do a "fc /b" with
an original version)

2. start with a new, empty batch file and enter the command,
maybe there is some undisplayed character in the old batch file


Stanley Daniel de Liver

unread,
Apr 21, 2013, 8:23:05 AM4/21/13
to
On Sun, 21 Apr 2013 05:24:09 +0100, foxidrive <n...@this.address.invalid>
wrote:

> On 21/04/2013 3:14 PM, Robert Baer wrote:
>
>> Ages ago i used to know how to turn on copy of all what one sees on
>> the screen / console and then turn that off, so..

Ctrl-P used to toggle output to also echo to printer.


[]

--
It's a money /life balance.

Todd Vargo

unread,
Apr 21, 2013, 9:37:28 AM4/21/13
to
Herbert, the problem mentioned in the link is the reason that I am using
XP today. When the final group of Microsoft updates entered my Win98
machine, I then started getting BSD issues regularly. Prior to the final
support update, I never had any BSD issues. I chalked it up to Microsoft
sabotaging the final updates to push people into giving up the DOS line.
That and drivers for new hardware tapered off is why I stopped using 98.

Also, I did not want to suggest that he reinstall the OS. CMD.EXE itself
may be ok but perhaps a supporting DLL may be corrupt. Unless he does a
FC with files on a working system, he will never know for sure. It seems
easy enough to copy the batch file in question to another machine and
run it there to verify no stray hidden characters are causing the issue.
Unfortunately, I get the impression that he would just retype it in the
second machine and say that is the same thing.

Todd Vargo

unread,
Apr 21, 2013, 9:44:42 AM4/21/13
to
On 4/21/2013 1:54 AM, Robert Baer wrote:
>
> Let me pete again (re-pete).
> At the CMD window, (again: CMD window) what i said in a BAT file
> (POO.BAT) DOES NOT WORK, the /S causes the RMDIR command to barf.
> Furthermore RMDIR /? shows the full expected command with /S and /Q.
> Now,at the console, it works when you type in EXACTLY what was in the
> BAT file.
> It should be obvious that the CLI is CMD.EXE, and not a non-available
> "command.com".
>
> So...if there is a way to use "command.com", lemme know and also how
> to make it a (temporary) default (and switch back).

It is only obvious to the person sitting at the machine. Those of us
sitting miles away can only rely on the information provided,
unfortunately, all indications are pointing towards reinstalling the OS
to solve the issue. Good luck.

foxidrive

unread,
Apr 21, 2013, 9:54:34 AM4/21/13
to
On 21/04/2013 11:44 PM, Todd Vargo wrote:

> unfortunately, all indications are pointing towards reinstalling the OS
> to solve the issue. Good luck.

The system file checker might exist in W2K. sfc.exe

If it is a corrupt system file then that will root it out.


--
foxi

foxidrive

unread,
Apr 21, 2013, 10:00:57 AM4/21/13
to
On 21/04/2013 11:37 PM, Todd Vargo wrote:

> Herbert, the problem mentioned in the link is the reason that I am using
> XP today. When the final group of Microsoft updates entered my Win98
> machine, I then started getting BSD issues regularly. Prior to the final
> support update, I never had any BSD issues. I chalked it up to Microsoft
> sabotaging the final updates to push people into giving up the DOS line.

My final install of Win98se is fully updated and runs fine. I suspect yours just had a 'glitch in the
mainframe'. I still have it as a VM in Virtualbox, even though Virtualbox doesn't support it officially.

> That and drivers for new hardware tapered off is why I stopped using 98.

I never looked back after switching to XP.

IMO Vista is ok, Win 7 is better - Win 8 is overrated.

Win 8 has compatibility issues with programs that ran fine in Win 7, and Win 7 is a good, stable and
still supported OS.


--
foxi

Todd Vargo

unread,
Apr 21, 2013, 10:36:31 AM4/21/13
to
SFC is broken on my XP system. Installed as sp1. Updated to sp2 years
later. Updated again to sp3 more years later. SCF asks for the install
cd which is sp1 but says it is the wrong cd. Apparently the update chain
is broken and I am not interested in reinstalling. This machine is not
supported by Win7 so I will upgrade only when this hardware becomes
non-functional (or a freebie falls into my lap).

foxidrive

unread,
Apr 21, 2013, 10:56:32 AM4/21/13
to
On 22/04/2013 12:36 AM, Todd Vargo wrote:
> On 4/21/2013 9:54 AM, foxidrive wrote:
>> On 21/04/2013 11:44 PM, Todd Vargo wrote:
>>
>>> unfortunately, all indications are pointing towards reinstalling
>>> the OS to solve the issue. Good luck.
>>
>> The system file checker might exist in W2K. sfc.exe
>>
>> If it is a corrupt system file then that will root it out.
>
> SFC is broken on my XP system. Installed as sp1. Updated to sp2 years
> later. Updated again to sp3 more years later. SCF asks for the install
> cd which is sp1 but says it is the wrong cd. Apparently the update chain
> is broken and I am not interested in reinstalling. This machine is not

Your system is SP3 so it wants a SP3 cdrom, at a guess. You can slipstream the SP3 into a SP1 cdrom.
Or download a SP3 cdrom.


> supported by Win7 so I will upgrade only when this hardware becomes
> non-functional (or a freebie falls into my lap).

What part is not supported by Win7? Just curious as XP is a fine system, it's just not supported in a
years time, so malware writers will slobber over themselves when they find more vulnerabilities (for the
people that don't upgrade).

You might find that Win 7 will run fine.


--
foxi

Todd Vargo

unread,
Apr 21, 2013, 11:35:08 AM4/21/13
to
IIRC, the Win7 compatibility checker mentioned incompatible processor,
memory, and video. I did not keep a copy of the results.

Todd Vargo

unread,
Apr 21, 2013, 11:36:43 AM4/21/13
to
Oh, and don't get me started on who I believe the real malware authors
really are. :)

foxidrive

unread,
Apr 21, 2013, 11:41:31 AM4/21/13
to
On 22/04/2013 1:36 AM, Todd Vargo wrote:

>> IIRC, the Win7 compatibility checker mentioned incompatible processor,
>> memory, and video. I did not keep a copy of the results.

processor? Is yours a 386 Dx range? :)

ram? Windows doesn't care what RAM hardware it is. The more the merrier though.

Video card - I expect it will run on a 64 MB card if pressed, just don't expect Aero features to work.
MS removed Aero in Win8 FWIW.


> Oh, and don't get me started on who I believe the real malware authors
> really are. :)

MS? :)


--
foxi

Robert Baer

unread,
Apr 22, 2013, 4:28:54 AM4/22/13
to
foxidrive wrote:
> On 20/04/2013 2:39 PM, Bob wrote:
>> 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?
>
> It's possible that there is another RMDIR.BAT/CMD on the path, and the behaviour would depend on the
> content of the file. That's the line that I was suggesting...
>
>
Like i said a number of times, do NOT ever give a system name to a
CMD or BAT file.
RMDIR.BAT and RMDIR.CMD violates that rule.
Create the BAT (as it has priority over CMD) and have its contents
say ECHO YOU WILL NEVER SEE THIS IF YOU USE RMDIR ON THE COMMAND LINE .

Robert Baer

unread,
Apr 22, 2013, 4:47:25 AM4/22/13
to
Tom Del Rosso wrote:
> Robert Baer wrote:
>>
>> So...if there is a way to use "command.com", lemme know and also how
>> to make it a (temporary) default (and switch back).
>
> By typing command of course.
>
>
Thanks!
OK; RMDIR /? produces EXACTLY the same syntax instructions for CMD
and for COMMAND; therefore typing in the RMDIR /S <folder> works EXACTLY
the same.
I cannot test the batch file now because i had (by hand) used RMDIR
to remove all of the undesirable temp folders.

**
OK, use CMD icon to get "window" for commands of various sorts.
I type COMMAND and get a line signifying i am at a MSDOS "window",
then if i type CMD i am back again.
BUT.............................
...............
...........
EXIT no longer works in either "window".
Three-finger salute was the only way to kill that process.
Not so swift.

Tom Del Rosso

unread,
Apr 22, 2013, 4:42:49 AM4/22/13
to

Robert Baer wrote:
> Tom Del Rosso wrote:
> > Robert Baer wrote:
> > >
> > > So...if there is a way to use "command.com", lemme know and
> > > also how to make it a (temporary) default (and switch back).
> >
> > By typing command of course.
> >
> >
> Thanks!
> OK; RMDIR /? produces EXACTLY the same syntax instructions for CMD
> and for COMMAND; therefore typing in the RMDIR /S <folder> works
> EXACTLY the same.
> I cannot test the batch file now because i had (by hand) used RMDIR
> to remove all of the undesirable temp folders.

Unfortunately it remains a mystery then.


> OK, use CMD icon to get "window" for commands of various sorts.
> I type COMMAND and get a line signifying i am at a MSDOS "window",
> then if i type CMD i am back again.
> BUT.............................
> ...............
> ...........
> EXIT no longer works in either "window".
> Three-finger salute was the only way to kill that process.
> Not so swift.

Exit the child process (command), then exit the parent process (cmd).

By typing cmd again you spawned a grandchild process instead.

frank.w...@gmail.com

unread,
Apr 22, 2013, 4:50:36 AM4/22/13
to
> I cannot test the batch file now because i had (by
>hand) used RMDIR to remove all of the undesirable temp
>folders.


When you can test it again try replacing "RMDIR" with
"RD". If the result is the same then it is not likely
caused by an extraneous file.

Frank

Todd Vargo

unread,
Apr 22, 2013, 6:37:22 AM4/22/13
to
On 4/22/2013 4:47 AM, Robert Baer wrote:
> Tom Del Rosso wrote:
>> Robert Baer wrote:
>>>
>>> So...if there is a way to use "command.com", lemme know and also how
>>> to make it a (temporary) default (and switch back).
>>
>> By typing command of course.
>>
>>
> Thanks!
> OK; RMDIR /? produces EXACTLY the same syntax instructions for CMD
> and for COMMAND; therefore typing in the RMDIR /S <folder> works EXACTLY
> the same.
> I cannot test the batch file now because i had (by hand) used RMDIR
> to remove all of the undesirable temp folders.

Correct, the syntax is exactly the same but you might think if one CLI
is corrupt then the other may not be. Unfortunately, from your
statements above, it appears your assessment is based on the help output
only. (We can not assume that you performed any actual testing based on
the statement above.)

>
> **
> OK, use CMD icon to get "window" for commands of various sorts.
> I type COMMAND and get a line signifying i am at a MSDOS "window",
> then if i type CMD i am back again.
> BUT.............................
> ...............
> ...........
> EXIT no longer works in either "window".
> Three-finger salute was the only way to kill that process.
> Not so swift.

So you have more than just a RMDIR issue.
Have you rebooted since this problem began?

Todd Vargo

unread,
Apr 22, 2013, 6:50:24 AM4/22/13
to
Yes, we know. But you posted the batch file above with the first line
stating "::FILE NAME RMDIR.BAT" causing that concern. And yes, order of
precedence internal before external, BUT only after DOSKEY. There
wouldn't happen to be a DOSKEY macro named RMDIR that perhaps you forgot
about?

DOSKEY /MACROS

Tom Del Rosso

unread,
Apr 22, 2013, 11:48:10 AM4/22/13
to

Todd Vargo wrote:
>
> So you have more than just a RMDIR issue.
> Have you rebooted since this problem began?

I think exit didn't work because he typed exit twice when he had 3 nested
command shells running.

Robert Baer

unread,
Apr 22, 2013, 4:57:39 PM4/22/13
to
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.

Robert Baer

unread,
Apr 22, 2013, 5:15:28 PM4/22/13
to
Ran SFC, it asked for my Win2K disk, ran for a while and made no
comments.
Did the "protect" thing Justin Case.

Todd Vargo

unread,
Apr 22, 2013, 4:19:42 PM4/22/13
to
On 4/22/2013 11:48 AM, Tom Del Rosso wrote:
> Todd Vargo wrote:
>>
>> So you have more than just a RMDIR issue.
>> Have you rebooted since this problem began?
>
> I think exit didn't work because he typed exit twice when he had 3 nested
> command shells running.

That would be too obvious. Assuming this is the same Robert Baer who
posted to alt.msdos over a decade ago, I would give him the benefit of
doubt.

Robert Baer

unread,
Apr 22, 2013, 5:28:46 PM4/22/13
to
Tom Del Rosso wrote:
> Todd Vargo wrote:
>>
>> So you have more than just a RMDIR issue.
>> Have you rebooted since this problem began?
>
> I think exit didn't work because he typed exit twice when he had 3 nested
> command shells running.
>
>
OH.
Had no idea there was nesting, and did not count them.
Trying now...wait..
..yep; OK.
Now one question on these..i see the notice of MSDOS mode only when
it is entered and when "exited" by saying CMD.
Say i fiddled around with CMD, COMMAND, again and again and maybe
once in a while issued an EXIT.
How can one tell how deep in the dodo one is, and how can one tell
which CLI is being used then (say i did a lot of this and that and forgot).

foxidrive

unread,
Apr 22, 2013, 4:50:05 PM4/22/13
to
On 23/04/2013 7:28 AM, Robert Baer wrote:
> Tom Del Rosso wrote:

>> I think exit didn't work because he typed exit twice when he had 3 nested
>> command shells running.
>>
>>
> OH.
> Had no idea there was nesting, and did not count them.
> Trying now...wait..
> ..yep; OK.
> Now one question on these..i see the notice of MSDOS mode only when
> it is entered and when "exited" by saying CMD.
> Say i fiddled around with CMD, COMMAND, again and again and maybe
> once in a while issued an EXIT.
> How can one tell how deep in the dodo one is, and how can one tell
> which CLI is being used then (say i did a lot of this and that and forgot).

Issuing the SET command will let you see what %comspec% is set to and that will tell you if you are in a
command.com or cmd.exe shell

The command.com is a stub and not a real command.com as it hands off most of the commands to a cmd.exe to
process. If you use echo %comspec% it will always show cmd.exe

AFAIK there is no command that will tell you how deeply you have nested shells.



--
foxi

Tom Del Rosso

unread,
Apr 22, 2013, 5:08:12 PM4/22/13
to

Robert Baer wrote:
> Tom Del Rosso wrote:
> > Todd Vargo wrote:
> > >
> > > So you have more than just a RMDIR issue.
> > > Have you rebooted since this problem began?
> >
> > I think exit didn't work because he typed exit twice when he had 3
> > nested command shells running.
> >
> >
> OH.
> Had no idea there was nesting, and did not count them.
> Trying now...wait..
> ..yep; OK.
> Now one question on these..i see the notice of MSDOS mode only when
> it is entered and when "exited" by saying CMD.

Although typing cmd doesn't cause its parent process to exit.


> Say i fiddled around with CMD, COMMAND, again and again and maybe
> once in a while issued an EXIT.
> How can one tell how deep in the dodo one is, and how can one tell
> which CLI is being used then (say i did a lot of this and that and
> forgot).

Process Explorer from Sysinternals will show all processes and their
parent-child relationships. MS bought them because MS never made decent
utilities, so sysinternals.com redirects to microsoft.com.

You should just start command.com in a separate window of its own by making
a separate shortcut for it.

I just discovered that commands are the same, so they appear to be executed
by cmd.exe in any case. Options like 'for /f' are not available in DOS but
they work, and the comspec variable is still set to cmd.exe. I had never
noticed that because there really isn't a reason to use command.com, and
since commands seem to execute the same way as in cmd there's even less of a
reason to use command than there would be if it worked as it did in DOS.

But you can tell the difference because the cmd window is scrollable,
whereas in the command window text that scrolls off the top is
unrecoverable. Also, the up-arrow retrieves past commands in cmd, but
command uses the old DOS method of F1 retyping characters, and in cmd the
tab key inserts the names of files in the current directory sequentially,
but in command tab is just tab.

Frank Westlake

unread,
Apr 22, 2013, 5:32:16 PM4/22/13
to
2013-04-22 14:28, Robert Baer:
> Say i fiddled around with CMD, COMMAND, again and again and maybe once
> in a while issued an EXIT.
> How can one tell how deep in the dodo one is, and how can one tell which
> CLI is being used then (say i did a lot of this and that and forgot).

I think the only way (other than counting EXITs) is to examine the process tree. If I recall correctly, you are using Windows 2000, which, if I recall
correctly, is very similar to Windows NT4, which, if I recall correctly, requires the resource kit to get some useful task utilities (KILL, etc.). The
task utility which reports a list of running process and their process IDs also, if I recall correctly, lists the parent process ID. So you could wrap
a script around this utility and show a process tree. There might be a script which does that in this group sometime between 2000 and 2004.

Alternatively, you could look for a third-party binary which does this same thing. I wrote one and have it locally but apparently I don't have it on
the Internet anywhere. I did see many other references to programs named "ptree.exe".

The task utilities have varied almost with each version of Windows so we can't put together a general script which will show the process tree.

My PTREE is unfinished and won't help you. Apparently I began it in 2006 and abandoned it soon afterwards, or perhaps I decided that it did all I
needed it for. Here is the output of "ptree /?":

C:\w>ptree /?
Version A, Frank P. Westlake, Sep 19 2006.
Template file.

[COMMAND | ] _ [or < FILE] [or TEXT]

OPTIONS:
/?

Top Level
1820 [unknown]
1408 [unknown]
4404 [unknown]
9648 ptree /?

Frank

Frank Westlake

unread,
Apr 22, 2013, 5:40:10 PM4/22/13
to
2013-04-22 14:08, Tom Del Rosso:
> But you can tell the difference because the cmd window is scrollable,
> whereas in the command window text that scrolls off the top is
> unrecoverable. Also, the up-arrow retrieves past commands in cmd, but
> command uses the old DOS method of F1 retyping characters, and in cmd the
> tab key inserts the names of files in the current directory sequentially,
> but in command tab is just tab.

I vaguely recall that sometimes CMD would invoke COMMAND for a 16-bit
program in the script then immediately return to CMD. The visual effect
is that the console appears to jerk. I don't have COMMAND.COM and I
don't recall if "RD /S" is available but if it is not and Robert is
invoking this script through a 16-bit program then it might run in
COMMAND.COM instead of CMD.EXE.

Frank

Todd Vargo

unread,
Apr 22, 2013, 5:41:33 PM4/22/13
to
If you type "set comspec", cmd will return it's path but command will
report a syntax error. Also, if you type SET, comspec is displayed in
cmd but not in command.

>
> AFAIK there is no command that will tell you how deeply you have nested shells.

And you can not use on taskmgr or tasklist because they do not show a
chain of child processes.

foxidrive

unread,
Apr 22, 2013, 5:53:53 PM4/22/13
to
On 23/04/2013 7:41 AM, Todd Vargo wrote:
> On 4/22/2013 4:50 PM, foxidrive wrote:

>> Issuing the SET command will let you see what %comspec% is set to and that will tell you if you are in a
>> command.com or cmd.exe shell
>>
>> The command.com is a stub and not a real command.com as it hands off most of the commands to a cmd.exe to
>> process. If you use echo %comspec% it will always show cmd.exe
>
> If you type "set comspec", cmd will return it's path but command will
> report a syntax error.

Confirmed in Windows 8.

> Also, if you type SET, comspec is displayed in cmd but not in command.

Not in XP? It does in Win8.

It's not alphabetic - compspec is the first item.



--
foxi

Todd Vargo

unread,
Apr 22, 2013, 6:38:18 PM4/22/13
to
"compspec"? Typo or did Microsoft actually change that?

What is interesting is that Win8 even bothers to include COMMAND at all
much less that Microsoft would bother to alter the alphabetic listing of
SET. They spend too much time messing with things that work and not
enough on fixing things that are "flaky".

Todd Vargo

unread,
Apr 22, 2013, 6:48:10 PM4/22/13
to
Oops, I just took a stronger look at the output of SET in COMMAND.
Indeed, COMSPEC is moved to the top of the list with the remainder of
the list in alphabetic order. CMD displays ComSpec in mixed case while
COMMAND displays it in all caps.

Robert Baer

unread,
Apr 25, 2013, 1:45:57 AM4/25/13
to
Auric__ wrote:
> 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".
>>>> WTF?
>>>
>>> Assuming you mean rmdir, it works for me, batch file or otherwise. What
>>> version of Windows, and what's your entire batch look like?
>>>
>> OS is Win2K pro; file is:
>> 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}
>
> Well, that works for me on my Win2k install.
>
> Are you just looking to clear your temp directory? If so, this should work:
>
> rd /s %TEMP%
> md %TEMP%
>
> Or this, from within %TEMP%:
>
> for /d %x in (*) do rd /s /q "%x"
>
> (Double the percent signs for within a batch, of course; %%x instead of %x.)
>
Basically, i want to clean out the TEMP folder, but..there are two
folders that must remain so that my AV cannot have hissy fits.
So..my BATch file calls a BASIC (QBX) program that parses the
DIRectory file i have it generate, and then outputs the file with the
desired RMDIR commands (no others).


Robert Baer

unread,
Apr 25, 2013, 1:54:53 AM4/25/13
to
Thanks, that helps some.

Robert Baer

unread,
Apr 25, 2013, 1:59:36 AM4/25/13
to
Both CMD and COMMAND CLIs report exactly the same syntax for RMDIR (/S
and/Q).

Robert Baer

unread,
Apr 25, 2013, 2:02:35 AM4/25/13
to
* discovered that by fiddling around; thanks.

>
>>
>> AFAIK there is no command that will tell you how deeply you have
>> nested shells.
* yea, and methinks no batch file could dig one out, either.

>
> And you can not use on taskmgr or tasklist because they do not show a
> chain of child processes.
* That was one of the first things i tried, and got slapped in the face
with a "no show" like you mentioned...

>

Tom Del Rosso

unread,
Apr 25, 2013, 1:10:43 AM4/25/13
to

Robert Baer wrote:
> Todd Vargo wrote:
> > And you can not use on taskmgr or tasklist because they do not show
> > a chain of child processes.
> * That was one of the first things i tried, and got slapped in the
> face with a "no show" like you mentioned...

But the taskmgr substitute, process explorer, does show it as I said.

foxidrive

unread,
Apr 25, 2013, 1:59:16 AM4/25/13
to
On 25/04/2013 3:45 PM, Robert Baer wrote:

> Basically, i want to clean out the TEMP folder, but..there are two
> folders that must remain so that my AV cannot have hissy fits.
> So..my BATch file calls a BASIC (QBX) program that parses the
> DIRectory file i have it generate, and then outputs the file with the
> desired RMDIR commands (no others).

Do you shell to execute the file, from within your basic?


--
foxi

Stanley Daniel de Liver

unread,
Apr 25, 2013, 2:38:40 PM4/25/13
to
On Thu, 25 Apr 2013 07:02:35 +0100, Robert Baer <rober...@localnet.com>
wrote:

> Todd Vargo wrote:
>> On 4/22/2013 4:50 PM, foxidrive wrote:
>>> On 23/04/2013 7:28 AM, Robert Baer wrote:

[]
>>
>>>
>>> AFAIK there is no command that will tell you how deeply you have
>>> nested shells.
> * yea, and methinks no batch file could dig one out, either.
>

In the olde DOS days, you could chase up the environment chain.


--
It's a money /life balance.
0 new messages