Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7913985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:58:26+00:00 2026-06-03T13:58:26+00:00

I am a Linux user forced to work on a Windows workstation at work.

  • 0

I am a Linux user forced to work on a Windows workstation at work. I have a script that I wrote for bash, that I need to convert to Windows Batch. In the past, I haven’t had too much trouble, but now I have run into two issues I cannot figure out. Here is the original Linux script:

#!/bin/bash
if [ $# != 1 ] ; then
    echo "usage: createMavenDirs.sh <name>"
    exit 1
fi
timestamp=`date +"%Y-%m-%d-%s"`
projectName="${1}_${timestamp}"
groupID="com.hostname"
version="1.0"
pomFill="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project>\n\t<modelVersion>4.0.0</modelVersion>\n\t<groupId>${groupID}.${1}</groupId>\n\t<artifactId>${1}</artifactId>\n\t<name>\${artifactId}</name>\n\t<version>${version}</version>\n</project>"

clear

mkdir -p ${projectName}/src/{main/{java,resources,filters,assembly,config,webapp},test/{java,resources,filters},site}
touch ${projectName}/{LICENSE,NOTICE,README}.txt
touch ${projectName}/pom.xml
echo -e ${pomFill} > ${projectName}/pom.xml

tree ${projectName}

exit 0

First off, I want to say that “yes”, I know there are tools for doing this, but due to VERY tight constraints at work, I have to use an option like this. Second, here are the two problems I am having.

  1. The “mkdir” line: Does Windows have a way to do this like Linux does?

  2. The “echo” line where I create the pom file: Can Windows echo a newline and tab, and redirect it into an external file like I am doing in my Bash script?

Like I said, I know there are other ways to do this, but the powers that be have forced me down this path. Anyway, thank you to all who have taken the time to read.

Have a good day 🙂

UPDATE: I realize that Windows does have an “echo” and “mkdir”, but I need to be able to use them in a very specific way, just like I have used them in my Linux script. Specifically, I would like to make directories exactly like I have in my Linux script, and I need to echo a newline ‘\n’ or ‘\r’ and a tab ‘\t’ into an external file.

UPDATE 2: I cannot install any new software/utilities/etc. onto my workstation. I must use only what is there.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:58:27+00:00Added an answer on June 3, 2026 at 1:58 pm

    After update:

    There is essentially no way to do what you request with batch files.

    Batch files are broken. Bite the bullet and use Java. (Or cheat by using Jython…)

    Original:

    1. The equivalent command for windows to mkdir is md or mkdir:

      c:\>mkdir \foo\bar
      
      c:\>dir
      [...]   foo  [...]
      
    2. echo is available in batch too:

      c:\>echo some text> Myfile.txt
      
      c:\>type Myfile.txt
      some text
      
      c:\>
      

      Note the gotcha: quotes will end up in your script too. So for example, echo "abcdef" will also print the double quotes.

      As far as I understand, the echo command does not support tab character escape.

    You can learn more at this batch reference.

    As an aside, I’d recommend just running bash on windows, via Cygwin if you can… If you have Python, that could also be a lifesaver. I feel for you if neither of those options are available…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small in-house Python script for Linux that creates a /home/user/environ_script.sh file
We have a linux app that depends on the speed with which the user
I'm a longtime Windows and Linux user and have had some weird experiences writing
I have two machines I work on: Windows Client (Development Machine) Linux Web Server
Can any user run inline assembly for current linux kernel or does that require
I'm an Ubuntu Linux user and I use Win XP only for my work
I have a Linux device driver that interfaces to a device that, in theory,
I have a linux DHCP server which I need to redirect all web traffic
I'm a Linux user, and I have been very hesitant to use Glade to
I'm writing some web UI pages that can be used to create Linux user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.