| 1. |
Solve : Copy command not working? |
|
Answer» 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]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? 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.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? 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 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.regCode: [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? 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?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 [emailprotected]@ Echo ; : B [emailprotected]@ Echo ; : # [emailprotected]@ Echo ; : @ [emailprotected]@ Echo ; : @ [emailprotected]@ Echo ; : @ @ Echo ; : @ .:,,,;r Echo ; : @H2SiiSXX Echo ; ##: @ Echo ;r , ,,. ..,;@ Echo ;r S95SS5; [emailprotected]@ Echo ;; @ [emailprotected]@ Echo ;. @ [emailprotected]@ Echo ; # [emailprotected]@ Echo ;: @ [emailprotected]@ 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 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? |
|