Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Copy command not working  (Read 4034 times)

0 Members and 1 Guest are viewing this topic.

youngbucks

    Topic Starter


    Rookie

    Copy command not working
    « on: May 10, 2008, 04:04:27 PM »
    Everytime i put in the command to copy a folder it says its completed but i check the directory and still nothing. This is the script that im trying atm:
    Code: [Select]
    SET COPYCMD=/Y
    ROBOCOPY "C:\test" C:\test2  /E /V /L
    pause

    Before i was using XCOPY but still had no luck :( Help please if you can.

    DarkendHeart



      Beginner

      Thanked: 1
      Re: Copy command not working
      « Reply #1 on: May 10, 2008, 04:32:21 PM »
      Try using.
      Code: [Select]
      xcopy "C:\test" C:\test2 /v /y /e
      pause
      It works fine for me.

      youngbucks

        Topic Starter


        Rookie

        Re: Copy command not working
        « Reply #2 on: May 10, 2008, 04:43:50 PM »
        ty it worked  ;D

        youngbucks

          Topic Starter


          Rookie

          Re: Copy command not working
          « Reply #3 on: May 10, 2008, 05:26:30 PM »
          Ok another problem has arose, i dont know if its because im building this on vista but the simplest scripts are giving errors.  My start command doesnt work now  ???

          Code: [Select]
          START %CURRDIR%\..\Backup.reg
          When i do it like that it says it cannot find the file but when it has the "" it opens a cmd window and i dnt want that.

          Dias de verano

          • Guest
          Re: Copy command not working
          « Reply #4 on: May 10, 2008, 05:36:59 PM »
          Code: [Select]
          START %CURRDIR%\..\Backup.regWhen i do it like that it says it cannot find the file but when it has the "" it opens a cmd window and i dnt want that.

          is %currdir% set to some value?

          youngbucks

            Topic Starter


            Rookie

            Re: Copy command not working
            « Reply #5 on: May 10, 2008, 05:43:40 PM »
            no, im trying to let it start the registry entry from inside its current directory. Its supposed to launch it from the folder E1 which would be in whatever directory the user copies it to.

            Dias de verano

            • Guest
            Re: Copy command not working
            « Reply #6 on: May 10, 2008, 05:47:07 PM »
            Please explain more fully.

            What is the purpose of the variable %currdir%? does it actually appear in the batch file? Why are you using it? What (and where) is the folder E1?

            Quote
            %CURRDIR%\..\Backup.reg

            Does this line actually appear in your batch? Just like that?

            youngbucks

              Topic Starter


              Rookie

              Re: Copy command not working
              « Reply #7 on: May 10, 2008, 05:52:31 PM »
              Im not 100% sure what your asking for but ill try by best to explain. Im creating a cmd based installer to fix a problem with a printer for a few people and there is a registry key entry that they are missing which i have taken off my computer and put into the folder E1 and named it Backup.reg so if you extracted everything i gave you it would be Wherever you copied it to\Fix\E1\Backup.reg. Im trying to make it so that it will launch the registry entry from the folder during the installation process so im trying to use the START command which leads me to the problem i now have with getting it to work.

              Here is my full script so far, if theres a problem in it stopping it from launching let me know.
              Quote
              @echo off
              color 04
              title Fallen Soilders Release: Fix For Printer V.02
              Echo .:,,,,,,,,,,,,,      .,,,,,,,.                                         
              Echo ;@@@@@@@@@@@@@@s   @@@@@@@@@@@@#                                       
              Echo ;@@@@@@@@@@@@@@;  @@@@@@@@@@@@@@@                                     
              Echo ;@@@@@@  @@@@@@:  @@@@@@H H@@@@@@                                     
              Echo ;@@@@@@  @@@@@@:  @@@@@@B H@@@@@@                                     
              Echo ;@@@@@@  @@@@@@:  @@@@@@# B@@@@@@                                     
              Echo ;@@@@@@  @@@@@@:  @@@@@@@ B@@@@@@                                     
              Echo ;@@@@@@  @@@@@@:  @@@@@@@ M@@@@@@                                     
              Echo ;@@@@@@  @@@@@@:  @@@@@@@ @@@@@@@                                     
              Echo ;@@@@@@  @@@@@@:  @@@@@@@ .:,,,;r                                     
              Echo ;@@@@@@  @@@@@@:  @@@@@@@H2SiiSXX                                     
              Echo ;@@@@@@  @@##@@:  @@@@@@@@@@@@@@@                                     
              Echo ;@@@@@@r      ,   ,,. ..,;@@@@@@@                                     
              Echo ;@@@@@@@@@@@@@@r  S95SS5; A@@@@@@                                     
              Echo ;@@@@@@@@@@@@@@;  @@@@@@@ B@@@@@@                                     
              Echo ;@@@@@@.          @@@@@@@ B@@@@@@                                     
              Echo ;@@@@@@           @@@@@@# H@@@@@@                                     
              Echo ;@@@@@@:          @@@@@@@ B@@@@@@                                     
              Echo ;@@@@@@r          :@@@@@@@@@@@@@r                                                                   

              Echo Fallen Soilders Release: Fix For Printer V.02
              echo.
              :BEGIN
              echo 1. Install
              echo 2. Uninstall
              echo 3. Exit
              :B2
              set /p choice=What do you want to do?
              if "%choice%"=="1" goto Install
              if "%choice%"=="2" goto Uninstall
              if "%choice%"=="3" goto End
              if "%choice%"==" " goto False

              :False
              Echo That response does not Corespond!
              goto :B2

              : Install
              :I1
              IF EXIST "%0\..\E1.cab" (echo All Files Found. Press Enter To Continue...) ELSE goto CheckF
              IF EXIST "%0\..\E1" goto :I2 ELSE goto :I1
              Pause
              Echo Running Extraction Process
              TASKKILL /F /IM explorer.exe
              EXPAND -r -F:* "%0\..\E1.cab" %TEMP%
              Move %TEMP%\E1 "%CURRDIR%"
              :I2
              Pause
              START %CURRDIR%\Backup.reg
              SET COPYCMD=/Y
              xcopy "%0\..\E1\system32" C:\test2 /v /y /e /i /c
              START C:\Windows\explorer
              goto :BEGIN

              :CheckF
              Echo File Checking has failed!
              Pause
              goto :BEGIN

              :Uninstall
              Echo Currently Uninstalling All Files...
              DEL /s /q "%0\..\E1"
              RD /s /q "%0\..\E1"
              RD /s /q "C:\test2"
              Pause
              goto :BEGIN

              Nevermind i fixed it, for some reason the command could not reach the file, probably because its a registry entry but i changed it to:

              Code: [Select]
              REGEDIT %CURRDIR%\..\Backup.reg
              « Last Edit: May 10, 2008, 07:13:06 PM by youngbucks »

              Dias de verano

              • Guest
              Re: Copy command not working
              « Reply #8 on: May 11, 2008, 12:47:01 AM »
              Code: [Select]
              %CURRDIR%
              What I am trying to find out is, why are you using this variable? It isn't a standard Windows thing. It exists on Linux/Unix systems though. What value is it supposed to have? Who told you to use it?

              Is this a batch file you copied from somewhere? Because if you wrote it yourself you would know what I am asking?

              Also, what are you expecting %0\..\ to be doing here?

              Code: [Select]
              IF EXIST "%0\..\E1.cab"
              I can see a few other things that need fixing, but if you could answer my questions above for now?






              youngbucks

                Topic Starter


                Rookie

                Re: Copy command not working
                « Reply #9 on: May 11, 2008, 06:16:21 AM »
                I just started to learn cmd programming and im putting this together from basic things i remember so thats why im not 100% on what your asking. The script you see was written by me from scratch and with the help of this website http://www.ss64.com/index.html . As for "%0\..\" i placed it there under the influence that when cmd looks for the file it will search all directories (acting as something like a wildcard) until it finds the file. Im trying by best to explain because im new to this, and since you found some problems if you dont mind could you please point them out so i dont make the same mistake again.

                Edit* Also if this not too much, is there a way for this batch file to create a report and send it to my computer from someone elses?

                Dias de verano

                • Guest
                Re: Copy command not working
                « Reply #10 on: May 11, 2008, 06:49:07 AM »
                Well, these are the points that spring out at me, after you have fixed these it might be nearer to working
                 
                @echo off
                color 04

                REM Corrected spelling of 'soldiers'

                title Fallen Soldiers Release: Fix For Printer V.02
                Echo .:,,,,,,,,,,,,,      .,,,,,,,.                                         
                Echo ;@@@@@@@@@@@@@@s   @@@@@@@@@@@@#                                       
                Echo ;@@@@@@@@@@@@@@;  @@@@@@@@@@@@@@@                                     
                Echo ;@@@@@@  @@@@@@:  @@@@@@H H@@@@@@                                     
                Echo ;@@@@@@  @@@@@@:  @@@@@@B H@@@@@@                                     
                Echo ;@@@@@@  @@@@@@:  @@@@@@# B@@@@@@                                     
                Echo ;@@@@@@  @@@@@@:  @@@@@@@ B@@@@@@                                     
                Echo ;@@@@@@  @@@@@@:  @@@@@@@ M@@@@@@                                     
                Echo ;@@@@@@  @@@@@@:  @@@@@@@ @@@@@@@                                     
                Echo ;@@@@@@  @@@@@@:  @@@@@@@ .:,,,;r                                     
                Echo ;@@@@@@  @@@@@@:  @@@@@@@H2SiiSXX                                     
                Echo ;@@@@@@  @@##@@:  @@@@@@@@@@@@@@@                                     
                Echo ;@@@@@@r      ,   ,,. ..,;@@@@@@@                                     
                Echo ;@@@@@@@@@@@@@@r  S95SS5; A@@@@@@                                     
                Echo ;@@@@@@@@@@@@@@;  @@@@@@@ B@@@@@@                                     
                Echo ;@@@@@@.          @@@@@@@ B@@@@@@                                     
                Echo ;@@@@@@           @@@@@@# H@@@@@@                                     
                Echo ;@@@@@@:          @@@@@@@ B@@@@@@                                     
                Echo ;@@@@@@r          :@@@@@@@@@@@@@r                                                                   

                Echo Fallen Soldiers Release: Fix For Printer V.02
                echo.
                :BEGIN
                echo 1. Install
                echo 2. Uninstall
                echo 3. Exit
                :B2
                set /p choice=What do you want to do?
                if "%choice%"=="1" goto Install
                if "%choice%"=="2" goto Uninstall

                REM Where is the :end label??? (I can't find it in your code)

                if "%choice%"=="3" goto End

                REM You don't need this, because if choice was not 1,2 or 3 you are going to wind up here anyway
                REM Also, you are testing for %choice% being a single space, which is a waste of time.


                if "%choice%"==" " goto False

                :False

                REM that was not how you spell 'correspond' and it should not have a capital C

                Echo That response does not correspond with a valid choice!
                goto :B2

                : Install
                :I1

                REM %0 is a special variable that means "the file name of this batch file"
                REM 2 dots .. means "the directory above this one"

                REM You need to specify properly where E1.cab is going to be


                IF EXIST "%0\..\E1.cab" (echo All Files Found. Press Enter To Continue...) ELSE goto CheckF
                IF EXIST "%0\..\E1" goto :I2 ELSE goto :I1
                Pause
                Echo Running Extraction Process
                TASKKILL /F /IM explorer.exe

                REM see above


                EXPAND -r -F:* "%0\..\E1.cab" %TEMP%

                REM %temp% should really be "%temp%"
                REM Change "%CURRDIR%" to "%CD%" wherever it occurs

                Move %TEMP%\E1 "%CURRDIR%"
                :I2
                Pause

                START %CURRDIR%\Backup.reg
                SET COPYCMD=/Y
                xcopy "%0\..\E1\system32" C:\test2 /v /y /e /i /c
                START C:\Windows\explorer
                goto :BEGIN

                :CheckF
                Echo File Checking has failed!
                Pause
                goto :BEGIN

                :Uninstall
                Echo Currently Uninstalling All Files...

                REM not sure why this is being done
                DEL /s /q "%0\..\E1"
                RD /s /q "%0\..\E1"

                RD /s /q "C:\test2"
                Pause
                goto :BEGIN


                youngbucks

                  Topic Starter


                  Rookie

                  Re: Copy command not working
                  « Reply #11 on: May 11, 2008, 10:51:36 AM »
                  Ok i made the changes and the uninstallation part is to let the batch file delete all the files it has extracted and placed on the computer. RD and DEL are there because when i run it on this computer it says "access is denied" even when it has been elevated to run as admin but i removed DEL and left RD now which removes everything including the folder. Is there a way for cmd to create a report and send it to my computer from the users?
                  « Last Edit: May 11, 2008, 11:14:49 AM by youngbucks »