| View previous topic :: View next topic |
| Author |
Message |
notused
Joined: 22 Nov 2010 Posts: 4
|
Posted: Tue Nov 23, 2010 6:56 am Post subject: problem with Xcopy variables, or something |
|
|
Hi everyone,
I have a problem with a batch file. No that statement is wrong, my .bat works fine but when I convert it to a exe I get errors.
My code is underneath.
You can skip the first lines untill you get to the echo of 2 paths. All the rest above it is simply the searching of both paths and checking if they're correct. Then I made a switch, to copy from path A to B or B to A and a delete statement to delete A. The delete works fin,
but when I use the first xcopy in a exe I get this:
file not found - cmdlnMYDOCPATH.
when I use the second xcopy in a exe I get this:
file not found - cmdlnCURRENT.
I know there's a similarity between these two errors, the path of the destination ofcourse but I don't see what the file is doing wrong or how to fix it.
EDIT: using version 3.2.4.0, although the splash screen says 3.2.8.0 .....
Can you guys and gals help me out?
Thx in advance!
| Code: | @ECHO off
for /f "tokens=1-2*" %%A in (' REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" ') do if "%%A"=="AppData" set MYDOCPATH=%%C
echo This user's document roaming is: %MYDOCPATH%
set CURRENT=%~dp0
set CURRENT=%CURRENT%SAVE\
c:
cd %MYDOCPATH%
cd..
set MYDOCPATH=%CD%
set MYDOCPATH=%MYDOCPATH%\Local\Criterion Games\Burnout Paradise\
echo %MYDOCPATH%
echo %MYDOCPATH%
echo %CURRENT%
:start
ECHO.
ECHO 1. Save to Hard Disk
ECHO 2. Save to Removable Drive
ECHO 3. Remove from Hard Disk
set choice=
set /p choice=Type the number select your choice.
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto hello
if '%choice%'=='2' goto bye
if '%choice%'=='3' goto deleting
ECHO "%choice%" is not valid please try again
goto start
:hello
XCOPY "%CURRENT%*.*" "%MYDOCPATH%" /Y /C /I /E /D /S
goto end
:bye
XCOPY "%MYDOCPATH%*.*" "%CURRENT%" /Y /C /I /E /D /S
goto end
:deleting
rmdir /s /q "%MYDOCPATH%"
goto end
:end |
|
|
| Back to top |
|
 |
|
|
support Site Admin
Joined: 13 Feb 2004 Posts: 302
|
Posted: Fri Nov 26, 2010 3:42 am Post subject: |
|
|
This bug has been confirmed, program considered that
"%CURRENT%*.*"
use the %* statement inside.
As workaround you can replace it with
"%CURRENT%\*.*" |
|
| Back to top |
|
 |
notused
Joined: 22 Nov 2010 Posts: 4
|
Posted: Sat Nov 27, 2010 8:05 pm Post subject: |
|
|
ok thx, i'll try  |
|
| Back to top |
|
 |
notused
Joined: 22 Nov 2010 Posts: 4
|
Posted: Mon Nov 29, 2010 4:59 pm Post subject: |
|
|
This my code becomes something like this.
well when I run the exe, it gives me the same error or it can't find the files, any other suggestions ,?
I guess the problem is that my path variables (CURRENT and MYDOCPATH) end with a \ I'm not sure though....
| Code: | @ECHO off
for /f "tokens=1-2*" %%A in (' REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" ') do if "%%A"=="AppData" set MYDOCPATH=%%C
echo This user's document roaming is: %MYDOCPATH%
set CURRENT=%~dp0
set CURRENT=%CURRENT%SAVE\
c:
cd %MYDOCPATH%
cd..
set MYDOCPATH=%CD%
set MYDOCPATH=%MYDOCPATH%\Local\Criterion Games\Burnout Paradise\
echo %MYDOCPATH%
echo %MYDOCPATH%
echo %CURRENT%
:start
ECHO.
ECHO 1. Save to Hard Disk
ECHO 2. Save to Removable Drive
ECHO 3. Remove from Hard Disk
set choice=
set /p choice=Type the number select your choice.
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto hello
if '%choice%'=='2' goto bye
if '%choice%'=='3' goto deleting
ECHO "%choice%" is not valid please try again
goto start
:hello
XCOPY "%CURRENT%\*.*" "%MYDOCPATH%" /Y /C /I /E /D /S
goto end
:bye
XCOPY "%MYDOCPATH%\*.*" "%CURRENT%" /Y /C /I /E /D /S
goto end
:deleting
rmdir /s /q "%MYDOCPATH%"
goto end
:end |
|
|
| Back to top |
|
 |
support Site Admin
Joined: 13 Feb 2004 Posts: 302
|
Posted: Mon Nov 29, 2010 8:24 pm Post subject: |
|
|
| We will release update soon. |
|
| Back to top |
|
 |
|