1.

Solve : Copier Batch File?

Answer»

Ok, I recently made a batch file to copy files from my hard drive to my flash drive but I need a possible way to save and import a text letter so I only need to put the drive letter in once.

Here are the two .BAT files:


@echo on
title Transfer to
cls
:input32
set INPUT32=
set /P INPUT32=Flash drive letter: %=%
cls
cd C:\Program Files\logger
pause
echo %INPUT32% > C:\dri.txt
copY %INPUT32%:\TaskGather\install\tr.*
start tr.bat
pause
del /F /Q tr.bat
pause
cls

---------------------------------------------------------------------------------------------------------------
Seperate batch file (tr.bat)
---------------------------------------------------------------------------------------------------------------

@echo off
cls
set INPUT32= [Now here is the place I need a way for the batch to READ C:\dri.txt and get the drive letter]
pause
copy Log.txt > %INPUT32%:\TaskGather\records\log.txt
DEL C:\dri.txt
pause
exit

First batch

Quote

@echo off
title Transfer to
cls
:input32
set INPUT32=
set /P INPUT32=Flash drive letter: %=%
cls
cd C:\Program Files\logger
pause
echo %INPUT32% > C:\dri.txt
copY %INPUT32%:\TaskGather\install\tr.*
start tr.bat %input32%
pause
del /F /Q tr.bat
pause
cls

tr.bat

Quote
@echo off
cls
pause
copy Log.txt > %1:\TaskGather\records\log.txt
DEL C:\dri.txt
pause
exit
Thanks man! It should work but I forgot something:
In the first batch in this command line:
Quote
cd C:\Program Files\logger
echo %INPUT32% > C:\dri.txt
copY %INPUT32%:\TaskGather\install\tr.* C:\Program Files\logger
start C:\Program Files\logger\tr.bat %input32%
pause
Ok, the text in the blue is the problem. It won't read Program Files correctly as it needs _ in place of a space. But I can't change it without messing up other programs. Is there a macro (example %time%, %username%) for Program Files that will shorten it?Quote from: HypercamJ on May 04, 2008, 05:32:45 PM
It won't read Program Files correctly as it needs _ in place of a space.

What do you mean? You have a folder called Program_Files? Or you didn't know about quoting paths with SPACES like this "C:\Program Files?" Or you never heard of %ProgramFiles%? Or none of these?




Discussion

No Comment Found