1.

Solve : Problem copy?

Answer»

Hello,

I made a cmd file with in it:
ECHO ECHO 1 - START Program >> %K%\%NAAM%.cmd
ECHO ECHO 2 - Delete Program >> %K%\%NAAM%.cmd
ECHO ECHO 3 - Exit >> %K%\%NAAM%.cmd
ECHO ECHO. >> %K%\%NAAM%.cmd
ECHO SET /P KEUZE=Type een nummer en druk ENTER: >> %K%\%NAAM%.cmd
ECHO IF %KEUZE%==1 GOTO Start >> %K%\%NAAM%.cmd
ECHO IF %KEUZE%==2 GOTO Del >> %K%\%NAAM%.cmd
ECHO IF %KEUZE%==3 GOTO Exit >> %K%\%NAAM%.cmd
ECHO :Start >> %K%\%NAAM%.cmd

This is not the whole file, but you need this.
This file will return this in an other file:
ECHO 1 - Start Program
ECHO 2 - Delete Program
ECHO 3 - Exit
ECHO.
SET /P KEUZE=Type een nummer en druk ENTER:
IF ==1 GOTO Start
IF ==2 GOTO Del
IF ==3 GOTO Exit
:Start

Maybe you already noticed that the %KEUZE% is gone after the IF.
This is what i want:
ECHO 1 - Start Program
ECHO 2 - Delete Program
ECHO 3 - Exit
ECHO.
SET /P KEUZE=Type een nummer en druk ENTER:
IF %KEUZE%==1 GOTO Start
IF %KEUZE%==2 GOTO Del
IF %KEUZE%==3 GOTO Exit
:Start

So how can i copy %KEUZE% without returning it empty?

Thx.It isn't APPEARING because at this point "%KEUZE% doesn't exist. Even if you assign a value to it, all it will echo to the new file is the current value of %KEUZE%. So, if you set KEUZE=0, it will echo:

IF 0==1 GOTO Start
IF 0==2 GOTO Del
IF 0==3 GOTO Exit

So, it will never start, del or exit.I know that, but there isn't a SOLUTION for my problem? Ok......ya got me! I'm lost to determine just what you're trying to do.

Are you trying to create a menu, to run different options or programs?

I've been doing that for thirty years, with a Menu.bat file to print Menu.txt on the screen.
Each item in the menu has a number, which is the name of another batch file to do the operation and then return to the menu.
i.e. 1.bat, 2.bat, and so on.

If that's really what you're trying to do, I can give you specific examples.
If not, pardon my interruption.

Cheers!
Shadow Try this...

echo %%KEUZE%% > fileQuote from: TheShadow on February 11, 2010, 04:28:20 PM

Ok......ya got me! I'm lost to determine just what you're trying to do.

Are you trying to create a menu, to run different options or programs?

I've been doing that for thirty years, with a Menu.bat file to print Menu.txt on the screen.
Each item in the menu has a number, which is the name of another batch file to do the operation and then return to the menu.
i.e. 1.bat, 2.bat, and so on.

If that's really what you're trying to do, I can give you specific examples.
If not, pardon my interruption.

Cheers!
Shadow
Got my answer from Helpmeh, but thanks anyway

Quote from: Helpmeh on February 11, 2010, 04:40:26 PM
Try this...

echo %%KEUZE%% > file

Thank you Ok, i got an other problem

This is my batch file:
ECHO @ECHO OFF > %K%\%NAAM%.cmd
ECHO ECHO. >> %K%\%NAAM%.cmd
ECHO ECHO 1 - Start Program >> %K%\%NAAM%.cmd
ECHO ECHO 2 - Delete Program >> %K%\%NAAM%.cmd
ECHO ECHO 3 - Exit >> %K%\%NAAM%.cmd
ECHO ECHO. >> %K%\%NAAM%.cmd
ECHO SET /P KEUZE=Type een nummer en druk ENTER: >> %K%\%NAAM%.cmd
ECHO IF %%KEUZE%%==1 GOTO Start >> %K%\%NAAM%.cmd
ECHO IF %%KEUZE%%==2 GOTO Del >> %K%\%NAAM%.cmd
ECHO IF %%KEUZE%%==3 GOTO Exit >> %K%\%NAAM%.cmd
ECHO :Start >> %K%\%NAAM%.cmd
ECHO CD "%NAAM%" >> %K%\%NAAM%.cmd
ECHO START %NAAM%.exe >> %K%\%NAAM%.cmd
ECHO EXIT >> %K%\%NAAM%.cmd
ECHO :Del >> %K%\%NAAM%.cmd
ECHO IF EXIST "%K%\%NAAM%" (GOTO Del2) ELSE (GOTO Problem) >> %K%\%NAAM%.cmd
ECHO :Del2 >> %K%\%NAAM%.cmd
ECHO RMDIR /S /Q "%NAAM%" >> %K%\%NAAM%.cmd
ECHO GOTO Klaar >> %K%\%NAAM%.cmd
ECHO :Problem >> %K%\%NAAM%.cmd
ECHO CLS >> %K%\%NAAM%.cmd
ECHO ECHO Kan %K%\%NAAM% niet vinden. Om %NAAM% te verwijderen moet u DIT >> %K%\%NAAM%.cmd
ECHO ECHO handmatig doen. %NAAM% is een verborgen map. Open Explorer en >> %K%\%NAAM%.cmd
ECHO ECHO druk op Alt+Z. Er komt een keuzelijst naar beneden, klik op >> %K%\%NAAM%.cmd
ECHO ECHO Mapopties.... Er opent nu een venster. Klik bovenaan op Weergave >> %K%\%NAAM%.cmd
ECHO ECHO Zorg nu dat er een BLAUW balletje voor "Verborgen bestanden, mappen >> %K%\%NAAM%.cmd
ECHO ECHO en stations weergeven" staat. Klik op OK en de verborgen mappen >> %K%\%NAAM%.cmd
ECHO ECHO zullen nu tevoorschijn komen. Zoek nu naar de map %NAAM% en >> %K%\%NAAM%.cmd
ECHO ECHO verwijder deze >> %K%\%NAAM%.cmd
ECHO ECHO Om de verborgen mappen weer te laten verdwijnen moet je het blauwe >> %K%\%NAAM%.cmd
ECHO ECHO balletje voor "Verborgen bestanden, mappen en stations niet >> %K%\%NAAM%.cmd
ECHO ECHO weergeven" zetten. Pas als je dit gedaan hebt kan je op ENTER drukken >> %K%\%NAAM%.cmd
ECHO PAUSE >> %K%\%NAAM%.cmd
ECHO GOTO Klaar >> %K%\%NAAM%.cmd
ECHO :Klaar >> %K%\%NAAM%.cmd
ECHO CLS >> %K%\%NAAM%.cmd
ECHO ECHO %NAAM% is nog niet helemaal verwijdert. >> %K%\%NAAM%.cmd
ECHO ECHO Als u dit bestand sluit en verwijdert, >> %K%\%NAAM%.cmd
ECHO ECHO is %NAAM% helemaal verwijdert. >> %K%\%NAAM%.cmd
ECHO PAUSE >> %K%\%NAAM%.cmd
ECHO :Exit >> %K%\%NAAM%.cmd
ECHO EXIT >> %K%\%NAAM%.cmd

but it's not returning the thing i want, it returns this:
@ECHO OFF
ECHO.
ECHO 1 - Start Program
ECHO 2 - Delete Program
ECHO 3 - Exit
ECHO.
SET /P KEUZE=Type een nummer en druk ENTER:
IF %KEUZE%==1 GOTO Start
IF %KEUZE%==2 GOTO Del
IF %KEUZE%==3 GOTO Exit
:Start
CD "uTorrent"
START uTorrent.exe
EXIT
:Del
IF EXIST "D:\uTorrent" (GOTO Del2) ELSE (GOTO Problem)
:Del2
RMDIR /S /Q "uTorrent"
GOTO Klaar
:Problem
CLS
ECHO Kan D:\uTorrent niet vinden. Om uTorrent te verwijderen moet u dit
ECHO handmatig doen. uTorrent is een verborgen map. Open Explorer en
ECHO druk op Alt+Z. Er komt een keuzelijst naar beneden, klik op
ECHO Mapopties.... Er opent nu een venster. Klik bovenaan op Weergave
ECHO zullen nu tevoorschijn komen. Zoek nu naar de map uTorrent en
ECHO verwijder deze
ECHO Om de verborgen mappen weer te laten verdwijnen moet je het blauwe
PAUSE
GOTO Klaar
:Klaar
CLS
ECHO uTorrent is nog niet helemaal verwijdert.
ECHO Als u dit bestand sluit en verwijdert,
ECHO is uTorrent helemaal verwijdert.
PAUSE
:Exit
EXIT

If you maybe already saw there are lines missing.
This are the lines that are missing:
Zorg nu dat er een blauw balletje voor "Verborgen bestanden, mappen
en stations weergeven" staat. Klik op OK en de verborgen mappen
balletje voor "Verborgen bestanden, mappen en stations niet
weergeven" zetten. Pas als je dit gedaan hebt kan je op ENTER drukken

How is it possible.
If somebody is wondering what language this is, it's Dutch

Thanks

anyone?Looking at the missing lines, it seems that all the ones omitted contain a single " character.

Try prefixing the " with the ^ escape char - eg
Code: [Select]ECHO ECHO Zorg nu dat er een blauw balletje voor ^"Verborgen bestanden, mappen >> %K%\%NAAM%.cmd


Discussion

No Comment Found