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 8414119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:05:20+00:00 2026-06-10T01:05:20+00:00

Hello i’m trying to write a program that takes 3 user inputs: file path,

  • 0

Hello i’m trying to write a program that takes 3 user inputs: file path, username, and computer name and then create a batch file for each computer name in the list. I have not written the create batch file part yet but I am having trouble taking the multiple computers from the computer text box and creating separate lines of code out of them.

So if there are 3 computer names inside the computer textbox, id like to when the user hits the button, output each computer name on a different line.

if the computer name textbox contained the following computer names: M22-LIBRL74258S, M22-LIBRL74257S, and M22-LIBRL74256S

the output would be :

XCOPY “C:\Documents and Settings\Administrator\Desktop\file.exe” “\M22-LIBRL74258S\c$\Users\username\desktop”

XCOPY “C:\Documents and Settings\Administrator\Desktop\file.exe” “\M22-LIBRL74257S\c$\Users\username\desktop”

XCOPY “C:\Documents and Settings\Administrator\Desktop\file.exe” “\M22-LIBRL74256S\c$\Users\username\desktop”

Thanks!

WindowsFormsApplication1
{
       public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void browsebtn_Click(object sender, EventArgs e)
    {
        {

            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Title = "Select a File to Send";

            // Show the Dialog.
            // If the user clicked OK in the dialog and

            if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
            {
                string strfilename = openFileDialog1.InitialDirectory + openFileDialog1.FileName;
                pathtxt.Text = strfilename.ToString();
            }

        }
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    private void createbtn_Click(object sender, EventArgs e)
    {

        string filepath = pathtxt.Text.ToString();

        string username = usertxtbox.Text.ToString();




        string computer = computerstxtbox.Text;
        string[] split = computer.Split(new char[] { '\n' });



        foreach (string l in split)
        {

            var strIP = "XCOPY \"" + pathtxt.Text + '"' + ' ' + '"' + "\\" + "\\" + l + "\\" + "c$" + "\\" + "Users" + "\\" + username + "\\" + "desktop" + '"';
            //This is to see it

            MessageBox.Show(strIP);
        }
  • 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-10T01:05:21+00:00Added an answer on June 10, 2026 at 1:05 am

    Try and replace the line

    string[] split = computer.Split(new char[] { '\n' });
    

    with this instead

    string[] split = computer.Split(new String[] {"\r\n"}, StringSplitOptions.None);
    

    Also if your computer names are seperated by commas, you must also specify them in the split. e.g. new String[] {“\r\n”, “,”}

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

Sidebar

Related Questions

hello friends i am trying to get a list of user id and want
Hello I have this problem with PyQt4-dev-tools that include: * a user interface compiler
Hello I have like this 2 tables class User public int UserId{get;set;} { ....
Hello everyone i am trying to format the input number range with php number_format
Hello guys I need to pass a string array over to a setter that
Hello Guys I am trying to figure out why i am gettings this error
Hello ever one I want to ask a question about file opening.I want to
Hello i have a TextField on my scene. It haves only digits, user input
Hello All I am trying to flatten a list in Ocaml. I am a
Hello There, I am new to phonegap.I am trying to record a audio clip

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.