[DOS] Batch file bestanden kopieren

Pagina: 1
Acties:
  • 132 views sinds 30-01-2008
  • Reageer

  • EnsconcE
  • Registratie: Oktober 2001
  • Laatst online: 16-08 19:46
Ik wil een batch file maken waarmee je twee verschillende bestanden naar 1 map kan kopieren met keuze. Op zo'n manier dat als ik op b.v. 1 druk dat hij 1.inf kopieert en als ik op 2 druk dat hij 2.inf kopieert. Nou ben ik er al mee bezig geweest maar ik kom er niet uit, volgens mij is het iets met "errorlevel".

[sub]
* EnsconcE heeft de search gebruikt maar heeft niks gevonden[/sub]

  • KillerAce_NL
  • Registratie: Juni 2001
  • Niet online

KillerAce_NL

If it ain't broke...


  • WOmBaT
  • Registratie: September 2000
  • Laatst online: 30-11-2025

WOmBaT

Nyaaa!!!

Dan moet je een programma hebben dat die toetsaanslag registreert. Ik zoek wel eventjes hoe je dat kon maken :)

  • WOmBaT
  • Registratie: September 2000
  • Laatst online: 30-11-2025

WOmBaT

Nyaaa!!!


  • KillerAce_NL
  • Registratie: Juni 2001
  • Niet online

KillerAce_NL

If it ain't broke...

Op woensdag 24 april 2002 13:30 schreef WOmBaT het volgende:
Dan moet je een programma hebben dat die toetsaanslag registreert. Ik zoek wel eventjes hoe je dat kon maken :)
Staat gewoon letterlijk voorgedaan op die site hoor.

  • almightyarjen
  • Registratie: Maart 2002
  • Laatst online: 16-08 20:35

almightyarjen

When does the hurting stop?

Je hebt ook nog het Choice command nodig, heb het vroeger ook wel gebruikt... Weet het niet precies meer, maar hier is een voorbeeldje:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
The CHOICE command was introduced in MS-DOS 6 and is still available in MS-DOS 7 
(Windows 95/98).

In Windows NT 4, CHOICE no longer is a part of the standard distribution. 
It is, however, available as part of the Windows NT 4 Resouce Kit.

On the other hand, if you still have that old unused MS-DOS 6 or Windows 95/98 
version lying around, you can use the CHOICE.COM from that version instead.

Syntax:
     Waits for the user to choose one of a set of choices. 
  
  CHOICE  [ /C[:]choices ]  [ /N ]  [ /S ]  [ /T[:]c,nn ] text 
  
     /C:choices Specifies allowable keys.
Default for English versions is YN 
  /N   Do not display choices an ? at end of prompt string. 
  /S   Treat choice keys as case sensitive. 
  /T:c,nn   Default choice to c after nn seconds. 
  text   Prompt string to display. 
  
     ERRORLEVEL is set to the offset of the key the user presses on choices.  

Examples:
 

The command 
CHOICE Do yo really want to quit
      
Will display the following line: 
Do yo really want to quit? [YN]
      
If the user presses Y, CHOICE exits with return code ("errorlevel") 1 (1st character in 
choices), if the user presse N, CHOICE exits with return code 2 (2nd character in choices).
  
CHOICE /C:ABCDN /N /T:N,10 Format drive A:, B:, C:, D: or None?
IF ERRORLEVEL 1 SET DRIVE=drive A:
IF ERRORLEVEL 2 SET DRIVE=drive B:
IF ERRORLEVEL 3 SET DRIVE=drive C:
IF ERRORLEVEL 4 SET DRIVE=drive D:
IF ERRORLEVEL 5 SET DRIVE=None
ECHO You chose to format %DRIVE%
      
The CHOICE command in this example will prompt the user with the following line: 
Format drive A:, B:, C:, D: or None?
      
If the user presses C, CHOICE exits with a return code ("errorlevel") 3 (3rd character in 
choices).
The IF ERRORLEVEL checks for 1, 2 and 3 are true (see the errorlevel page for an 
explanation of errorlevels), so the variable DRIVE will be set to "drive A:" first, 
then to "drive B:", and finaly to "drive C:".
So the ECHO command will display the line: 
You chose to format drive C:

:)

Patreon | Main Youtube | Work In Progress Youtube


  • EnsconcE
  • Registratie: Oktober 2001
  • Laatst online: 16-08 19:46
Sorry, maar het commando CHOICE is niet te gebruiken in windows 2000 :'(
Met die sites kom ik er niet echt uit. Is het ook mogelijk dat je het comp commando gebruikt en de dat je het bestandje gaat kopieren naar het bestand als hij niet gelijk is. Dus ik heb 1.inf en 2.inf en als 1.inf gelijk is aan c:\bestand.inf dan kopieert hij 2.inf, is 2.inf gelijk aan c:\bestand.inf dat hij dan 1.inf kopieert?

Ik heb al internet gekeken maar daar kan ik niks vinden

Verwijderd

Probeer dit eens op het windows operating system forum.
Wat de heren heirboven hebben gezegt werkt idd, maar als jij dat niet kan gebruiken omdat je win 2000 draait moet je dit ff op een ander forum gooien.

Succes ermee.
Pagina: 1