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

  • Home
  • SEARCH
  • 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 75587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:32:22+00:00 2026-05-10T20:32:22+00:00

In cmd.exe, I can execute the command copy c:\hello.txt c:\hello2.txt and it worked fine.

  • 0

In cmd.exe, I can execute the command ‘copy c:\hello.txt c:\hello2.txt’ and it worked fine. But in my C program, I ran this piece of code and got the following error:

#include <iostream>  using namespace std;  int main() {     system('copy c:\hello.txt c:\hello2.txt');     system('pause');      return 0; } 

Output: The system cannot find the file specified.

Anybody know what is going on here?

  • 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. 2026-05-10T20:32:23+00:00Added an answer on May 10, 2026 at 8:32 pm

    Inside C strings (and quite a few other languages that use the same escaping rules), \ should be \\ since it’s the escape character. It allows you to enter, in normal text, non-printable characters such as:

    • the tab character \t.
    • the carriage-return character \r.
    • the newline character \n.
    • others which I won’t cover in detail.

    Since \ is used as the escape character, we need a way to put an actual '\' into a string. This is done with the sequence \\.

    Your line should therefore be:

    system('copy c:\\hello.txt c:\\hello2.txt'); 

    This can sometimes lead to obscure errors with commands like:

    FILE *fh = fopen ('c:\text.dat', 'w'); 

    where the \t is actually the tab character and the file that you’re trying to open is:

                c:TABext.dat.

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

Sidebar

Ask A Question

Stats

  • Questions 68k
  • Answers 68k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer nib stands for 'NeXT Interface Builder', whereas xib is for… May 11, 2026 at 12:15 pm
  • added an answer Once you know this: You can create a Date by… May 11, 2026 at 12:15 pm
  • added an answer WebException exposes a StatusCode property that you can check. If… May 11, 2026 at 12:15 pm

Related Questions

In cmd.exe, I can execute the command copy c:\hello.txt c:\hello2.txt and it worked fine.
Example: You have a shortcut s to SomeProgram in the current directory. In cmd.exe
How can I open a cmd window in a specific location without having to
In Xcode, I can use CMD - R to run (or CMD - Y
How can I run a CMD or .bat file in silent mode? I'm looking
I launch a child process in Java as follows: final String[] cmd = {<childProcessName>};
I'm trying to write a Windows cmd script to perform several tasks in series.
I want to write an app that takes in a model filename via cmd
In C, are the shift operators ( << , >> ) arithmetic or logical?
In C++, there isn't a de-facto standard logging tool. In my experience, shops roll

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.