Tom's Hardware > Forum > Windows XP > Windows XP General Discussion > MOVE command does not work from .BAT or .CMD script

MOVE command does not work from .BAT or .CMD script

Forum Windows XP : Windows XP General Discussion - MOVE command does not work from .BAT or .CMD script

Tom's Hardware: Over 1.4 million members in 6 different countries available to answer all your high-tech questions. Sign up now! Its free!
Word :    Username :           
 

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

I have a .BAT file which moves backup files from the local hard drive to a
network share. It worked fine under Win98SE, but fails under WinXP. The
command which fails is:

MOVE /Y Backup\*.* \\ServerName\ShareName\FolderName

It returns a message "Bad command or file name".

If I open a command window, navigate to the same folder, and issue the exact
same command, it works fine. Any idea why the MOVE command would not run in a
batch file? Any way to make this work properly?

Sponsored Links
Register or log in to remove.

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

"Motek Kore Guy" <MotekKoreGuy@discussions.microsoft.com> wrote in message
news:B6132884-20CA-4E0B-AEDD-144F3E923354@microsoft.com...
> I have a .BAT file which moves backup files from the local hard drive to a
> network share. It worked fine under Win98SE, but fails under WinXP. The
> command which fails is:
>
> MOVE /Y Backup\*.* \\ServerName\ShareName\FolderName
>
> It returns a message "Bad command or file name".
>
> If I open a command window, navigate to the same folder, and issue the
exact
> same command, it works fine. Any idea why the MOVE command would not run
in a
> batch file? Any way to make this work properly?

There is something strange about your post. "Bad command
or file name" is a DOS error message - under WinXP the
wording is different. Furthermore, "move" is an internal
command under WinXP. If you have a Command Processor
then you have "move". I suspect the problem is caused by
some other command in your batch file, not by "move".
What other commands do you have in that batch file?

Reply to Anonymous

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

I agree, it's strange. The .BAT file is like this:

@ECHO ON
C:
CD "\Data Files\Accounting Data"
COPY *.* \\ServerName\ShareName\DataBackupDirectory
MOVE Backup\*.* \\ServerName\ShareName\DataBackupDirectory\Backup

The COPY command works fine. I get the "Bad command or file name"
immediately after the MOVE command (which is obvious as I have echo on), and
nothing gets moved. I can copy the command from the window and paste it into
another command box, and it works fine. I have tried renaming the .BAT file
to .CMD, and it does the same thing.


"Pegasus (MVP)" wrote:

>
> "Motek Kore Guy" <MotekKoreGuy@discussions.microsoft.com> wrote in message
> news:B6132884-20CA-4E0B-AEDD-144F3E923354@microsoft.com...
> > I have a .BAT file which moves backup files from the local hard drive to a
> > network share. It worked fine under Win98SE, but fails under WinXP. The
> > command which fails is:
> >
> > MOVE /Y Backup\*.* \\ServerName\ShareName\FolderName
> >
> > It returns a message "Bad command or file name".
> >
> > If I open a command window, navigate to the same folder, and issue the
> exact
> > same command, it works fine. Any idea why the MOVE command would not run
> in a
> > batch file? Any way to make this work properly?
>
> There is something strange about your post. "Bad command
> or file name" is a DOS error message - under WinXP the
> wording is different. Furthermore, "move" is an internal
> command under WinXP. If you have a Command Processor
> then you have "move". I suspect the problem is caused by
> some other command in your batch file, not by "move".
> What other commands do you have in that batch file?
>
>
>

Reply to Anonymous

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

What's even stranger is that the error message "Bad command
or file name" does not exist under WinXP! There something
wrong either with your environment or with your reporting.


"Motek Kore Guy" <MotekKoreGuy@discussions.microsoft.com> wrote in message
news:0CD1F9AE-366D-4E1F-A5E6-CBD547B06354@microsoft.com...
> I agree, it's strange. The .BAT file is like this:
>
> @ECHO ON
> C:
> CD "\Data Files\Accounting Data"
> COPY *.* \\ServerName\ShareName\DataBackupDirectory
> MOVE Backup\*.* \\ServerName\ShareName\DataBackupDirectory\Backup
>
> The COPY command works fine. I get the "Bad command or file name"
> immediately after the MOVE command (which is obvious as I have echo on),
and
> nothing gets moved. I can copy the command from the window and paste it
into
> another command box, and it works fine. I have tried renaming the .BAT
file
> to .CMD, and it does the same thing.
>
>
> "Pegasus (MVP)" wrote:
>
> >
> > "Motek Kore Guy" <MotekKoreGuy@discussions.microsoft.com> wrote in
message
> > news:B6132884-20CA-4E0B-AEDD-144F3E923354@microsoft.com...
> > > I have a .BAT file which moves backup files from the local hard drive
to a
> > > network share. It worked fine under Win98SE, but fails under WinXP.
The
> > > command which fails is:
> > >
> > > MOVE /Y Backup\*.* \\ServerName\ShareName\FolderName
> > >
> > > It returns a message "Bad command or file name".
> > >
> > > If I open a command window, navigate to the same folder, and issue the
> > exact
> > > same command, it works fine. Any idea why the MOVE command would not
run
> > in a
> > > batch file? Any way to make this work properly?
> >
> > There is something strange about your post. "Bad command
> > or file name" is a DOS error message - under WinXP the
> > wording is different. Furthermore, "move" is an internal
> > command under WinXP. If you have a Command Processor
> > then you have "move". I suspect the problem is caused by
> > some other command in your batch file, not by "move".
> > What other commands do you have in that batch file?
> >
> >
> >

Reply to Anonymous

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

On Wed, 24 Aug 2005 20:33:47 -0700, "Motek Kore Guy"
<MotekKoreGuy@discussions.microsoft.com> wrote:

>I agree, it's strange. The .BAT file is like this:
>
>@ECHO ON
>C:
>CD "\Data Files\Accounting Data"
>COPY *.* \\ServerName\ShareName\DataBackupDirectory
>MOVE Backup\*.* \\ServerName\ShareName\DataBackupDirectory\Backup
>
>The COPY command works fine. I get the "Bad command or file name"
>immediately after the MOVE command (which is obvious as I have echo on), and
>nothing gets moved. I can copy the command from the window and paste it into
>another command box, and it works fine.

I'm guessing bad line terminator between the two lines, or a
non-printing character somewhere.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
"My theory was a perfectly good one. The facts were misleading."
-- /The Lady Vanishes/ (1938)

Reply to Anonymous

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

On Thu, 25 Aug 2005 10:48:14 -0400, Stan Brown
<the_stan_brown@fastmail.fm> wrote:

>I'm guessing bad line terminator between the two lines, or a
>non-printing character somewhere.

I withdraw my comment -- I think the point Pegasus bought up is the
key. "Bad command or file name" is not a CMD.EXE error message.

If you are somehow running through old DOS (COMMAND.COM), you may be
hitting a line-length limit.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
"My theory was a perfectly good one. The facts were misleading."
-- /The Lady Vanishes/ (1938)

Reply to Anonymous

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

Thank you, Stan, this was the hint I needed. I had all of the .BAT files,
along with shortcuts (.PIF) saved off in a folder, and restored the folder to
the XP machine. Apparently, .PIF files created in Windows 98 will work in
Windows XP, but invoke the COMMAND.COM processor rather than the CMD.EXE
processor. In Win98, it worked because MOVE was an external command, not an
internal one. I deleted the shortcut, recreated it, and now it works fine.

Thanks again!

--- Jeremy Segal

"Stan Brown" wrote:

> On Thu, 25 Aug 2005 10:48:14 -0400, Stan Brown
> <the_stan_brown@fastmail.fm> wrote:
>
> >I'm guessing bad line terminator between the two lines, or a
> >non-printing character somewhere.
>
> I withdraw my comment -- I think the point Pegasus bought up is the
> key. "Bad command or file name" is not a CMD.EXE error message.
>
> If you are somehow running through old DOS (COMMAND.COM), you may be
> hitting a line-length limit.
>
> --
> Stan Brown, Oak Road Systems, Tompkins County, New York, USA
> http://OakRoadSystems.com/
> "My theory was a perfectly good one. The facts were misleading."
> -- /The Lady Vanishes/ (1938)
>

Reply to Anonymous

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

On Thu, 25 Aug 2005 10:19:02 -0700, "Motek Kore Guy"
<MotekKoreGuy@discussions.microsoft.com> wrote:

>"Stan Brown" wrote:
>> I withdraw my comment -- I think the point Pegasus bought up is the
>> key. "Bad command or file name" is not a CMD.EXE error message.
>>
>> If you are somehow running through old DOS (COMMAND.COM), you may be
>> hitting a line-length limit.
>>
>Thank you, Stan, this was the hint I needed. I had all of the .BAT files,
>along with shortcuts (.PIF) saved off in a folder, and restored the folder to
>the XP machine. Apparently, .PIF files created in Windows 98 will work in
>Windows XP, but invoke the COMMAND.COM processor rather than the CMD.EXE
>processor. In Win98, it worked because MOVE was an external command, not an
>internal one. I deleted the shortcut, recreated it, and now it works fine.

I'm delighted you found the problem, but I think Pegasus deserves
the lion's share of the credit. He's the one who pointed out the
error message couldn't possibly be right -- I didn't pick up on the
COMMAND.COM issue at all till I saw his note.

Anyway, thanks for letting us all know. It's so satisfying when a
nasty mystery turns out to have a simple explanation!

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
"What in heaven's name brought you to Casablanca?"
"My health. I came to Casablanca for the waters."
"The waters? What waters? We're in the desert."

Reply to Anonymous

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

"Stan Brown" <the_stan_brown@fastmail.fm> wrote in message
news:ijbug15hacba8mhbervvj1fa32kcho4jbr@4ax.com...
> On Thu, 25 Aug 2005 10:19:02 -0700, "Motek Kore Guy"
> <MotekKoreGuy@discussions.microsoft.com> wrote:
>
> >"Stan Brown" wrote:
> >> I withdraw my comment -- I think the point Pegasus bought up is the
> >> key. "Bad command or file name" is not a CMD.EXE error message.
> >>
> >> If you are somehow running through old DOS (COMMAND.COM), you may be
> >> hitting a line-length limit.
> >>
> >Thank you, Stan, this was the hint I needed. I had all of the .BAT files,
> >along with shortcuts (.PIF) saved off in a folder, and restored the
folder to
> >the XP machine. Apparently, .PIF files created in Windows 98 will work in
> >Windows XP, but invoke the COMMAND.COM processor rather than the CMD.EXE
> >processor. In Win98, it worked because MOVE was an external command, not
an
> >internal one. I deleted the shortcut, recreated it, and now it works
fine.
>
> I'm delighted you found the problem, but I think Pegasus deserves
> the lion's share of the credit. He's the one who pointed out the
> error message couldn't possibly be right -- I didn't pick up on the
> COMMAND.COM issue at all till I saw his note.

Maybe, but it was your post that finally nailed the culprit.

Reply to Anonymous
Tom's Hardware > Forum > Windows XP > Windows XP General Discussion > MOVE command does not work from .BAT or .CMD script
Go to:

There are 1108 identified and unidentified users. To see the list of identified users, Click here.

Please mind

You are about to answer a thread that has been inactive for more than 6 months.
If you still wish to proceed, please ensure that your posting is original and does not duplicate or overlap any prior responses to this thread.

Add a reply Cancel
Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them
  • 01:00 vianescute won the Freshman badge
  • 01:00 meywd won the Freshman badge
  • 01:00 nayega won the Freshman badge
  • 01:00 gpfear won the Freshman badge
  • 01:00 Conrad925 won the Freshman badge
  • 01:00 skythra won the Freshman badge
  • 01:00 Ckaz won the Freshman badge
  • 01:00 james59 won the Uniformed badge
  • 01:00 snarl won the Uniformed badge
  • 01:00 patlabor44 won the Uniformed badge