Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Sep 2003
    Location
    Houston, Texas, USA
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Windows XP/DOS (XP)

    Is it possible to run cmd.exe with a .bat file as a startup option? I can set the start folder for cmd.exe but it ignores my attempts to run a batch file. Only when I type in the name of the batch file on the command level will it work. I am trying to combine the two into one shortcut.

    Thanks for any help in advance.

    deutsch

  2. #2
    Silver Lounger
    Join Date
    Apr 2001
    Location
    New York, New York, USA
    Posts
    2,328
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Windows XP/DOS (XP)

    As I understand, you want (a) to run bat file on startup and ([img]/forums/images/smilies/cool.gif[/img] keep command prompt window open after the file executes. To accomplish (a) just create a shortcut to the bat file in Startup folder, to accomplish ([img]/forums/images/smilies/cool.gif[/img] add the line PAUSE (i.e. the line with the text "pause") at the end of the file. If you want to re-use command window, add CMD line instead.

  3. #3
    Star Lounger
    Join Date
    Sep 2003
    Location
    Houston, Texas, USA
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Windows XP/DOS (XP)

    Sorry, I see where my question was confusing. I want to be able to run cmd.exe with a startup option. In other words, I want to double click on the cmd.exe shortcut on the desktop and run the batchfile at the same time. Right now, I double click on cmd.exe shrtcut, it opens up a dos window in the folder that I specified, but I still need to type in the name of the batchfile to execute it. Is it possible to combine the two into one?
    Thank you very much for your help!

  4. #4
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Windows XP/DOS (XP)

    I'm also confused, but why don't you just make a shortcut out of your BATch file by right-clicking on it in Explorer and selecting "Create Shortcut"? Then you could (if you want) move it to the desktop. When you double-click on it, that will cause CMD.EXE to be loaded and run your BATch file. Or are you trying to pass parameter(s) to your BATch file?
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  5. #5
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Windows XP/DOS (XP)

    I had no problem doing this with a shortcut located in the User Startup folder. Shortcut's target should read like this example:

    C:WINDOWSSYSTEM32CMD.EXE /k C:Test.bat

    Note the "/k" switch ensures the Command window stays open (if that's what you want, otherwise use "/c"). When created shortcut I just entered "CMD.EXE" when saved shortcut Windows apparently adds the complete path to CMD.EXE. In test restarted Windows, the command window opened & executed batch file (test file that just displayed some text on screen) & stayed open for further commands.

    HTH

  6. #6
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Cairns, Queensland, Australia
    Posts
    885
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Windows XP/DOS (XP)

    For anyone interested, this would also work in Win2K.
    Granville

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •