We’d like to remind Forumites to please avoid political debate on the Forum.

This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.

📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide

Windows Command on multiple lines

wolfman
wolfman Posts: 3,225 Forumite
Hey, does anyone know how, in a .bat file, to separate a command over multiple lines.

So instead of having:

copy/b %folder%\jquery.base\jquery.js + %folder%\jquery.ui\jquery.dimensions.js + %folder%\jquery.ui\ui.mouse.js %folder%/merged.js

And that's only part of it. On one line it looks horrible and not very manageable.
I want (for easy of looking at)

copy/b
%folder%\jquery.base\jquery.js +
%folder%\jquery.ui\jquery.dimensions.js +
%folder%\jquery.ui\ui.mouse.js %folder%/merged.js

And ideally without using copy/b per line for each file.
"Boonowa tweepi, ha, ha."

Comments

  • iyiarz
    iyiarz Posts: 257 Forumite
    No I don't think you can as it wouldn't be a whole command any more. Turn WordWrapping on in notepad and resize the window :)
  • mdbarber
    mdbarber Posts: 1,116 Forumite
    use cut and paste to replicate the copy command easily then you can split it over lines
    copy the command (copy/b), count the number of + signs then paste the command for that amount of lines +1 pressing enter each time,,
    clarity is an important factor in batch files as we tend to write them and not change them till sometimes years later
    click here to achieve nothing!
  • wolfman
    wolfman Posts: 3,225 Forumite
    Yeah was thinking about replicating the copy command.

    Hmmm, think I might knock up a quick Java app to do it for me. Can list all the files to be merged in xml, and the app uses that.

    It's for our continuous integration process and we have a copy command that I think exceeded the allowed length. Plus it's very unreadable and hard to check if you missed a file from the command. Hence why I asked.
    "Boonowa tweepi, ha, ha."
  • isofa
    isofa Posts: 6,091 Forumite
    I think you can achieve this, if my memory serves me correctly...

    You need to use the caret character ^ this functions as a continuation delimiter in DOS/Command under Windows (but not original DOS) :)

    You can also do something like this, but no doubt I've got too many % signs in, but the principle is:

    set command_name=copy/b
    set optiona= %folder%\jquery.base\jquery.js
    set optionb=%folder%\jquery.ui\jquery.dimensions.js
    set optionc=%folder%\jquery.ui\ui.mouse.js
    set parameter=%folder%/merged.js

    %command_name% %optiona% %optionb% %optionc% %parameter%

    Yes I've definitely got far too many % signs!
  • wolfman
    wolfman Posts: 3,225 Forumite
    That's not too bad an idea. Might implement that in the short term.

    As it's critical though I'm gonna knock up a quick C# app to do it for me. Have it unit tested, and configurable via an xml file. Should reduce errors/typos etc... occurring.
    "Boonowa tweepi, ha, ha."
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 353.5K Banking & Borrowing
  • 254.1K Reduce Debt & Boost Income
  • 455K Spending & Discounts
  • 246.6K Work, Benefits & Business
  • 602.9K Mortgages, Homes & Bills
  • 178.1K Life & Family
  • 260.6K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16K Discuss & Feedback
  • 37.7K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.