Jump to content

Make bat file execute on windows startup from DOS


Recommended Posts

Posted

Hi all

I have come up against an unexpected problem, I have got a batch file that executes in DOS Mode to copy a file on my D drive to the Start menu\Programs\Startup directory. but it does not work, and I get an error "Bad filename or command". Here is part of my code:

copy D:\Batfil~1\defrag.bat C:\WINDOWS\STARTM~1\Programs\StartUp\defrag.bat

Is there a way to make msconfig start it instead? or am I overlooking something really obvious?

Can someone please help me? Thank you!


Posted

Have a look here:

http://www.ss64.com/nt/copy.html

As a general rule, unless you do need to change the name of the file, the destination path is sufficient:

copy D:\Batfil~1\defrag.bat C:\WINDOWS\STARTM~1\Programs\StartUp

try this:

CD C:\WINDOWS\STARTM~1\Programs\StartUp
copy D:\Batfil~1\defrag.bat

The first line changes directory to the destination.

The second one copies to the current dir the file.

It could be some problem with the 8.3 naming, the above should help in troubleshooting.

jaclaz

Posted

Thanks, I got it fixed by having it change directory to the file location and then just put in the filename without location.

Thanks for your help.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...