Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
542 connectés 

  FORUM HardWare.fr
  Programmation
  Shell/Batch

  redirection de fichier (ajout)

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

redirection de fichier (ajout)

n°1558356
philou192
Posté le 10-05-2007 à 17:54:56  profilanswer
 

Voilà mon problème : j'aimerais savoir si on peut faire une redirection de fichier pour
constater dans un fichier les fichiers déplacés par cette instruction :
 
For %%i in ("G:\test\"*.*) do (if exist "H:\HS\"%%~nxi move /y %%i "G:\KL-85\" )
 
Je sais qu'avec ce genre d'instruction, cela fonctionne:
 
xcopy "G:\Test\"*.* "G:\KL-85\" /y /c /k /z >> test.txt
 
Mais avec FOR, y a t'il un moyen ?
Et est ce que cela fonctionne aussi avec la fonction move ? ou del ?
 
Merci bcp pour l'aide que vous me fournissez.

mood
Publicité
Posté le 10-05-2007 à 17:54:56  profilanswer
 

n°1558548
wackevat
Posté le 11-05-2007 à 05:19:50  profilanswer
 

C'est pareil.
 
Tant que le stdout/stderr retourne qqch, quelque soit la commande qui en resulte, tu peux le recuperer par cette redirection de sortie.

n°1559155
philou192
Posté le 11-05-2007 à 20:06:32  profilanswer
 

Merci bcp, j'ai suivi tes conseils, fouillé un peu dans le forum et j'ai trouvé mon bonheur. à + pour d'autres conseils de ta part car ils me servent vraiment.

n°1559291
wackevat
Posté le 12-05-2007 à 03:29:30  profilanswer
 

Avec plaisir ;)
 
Si l'anglais ne te gene pas :

Citation :

A programmer can make his program output directly to the screen, which  
cannot be captured with redirection, but normal practice is to send  
text to standard out (represented by 1) and error messages to standard  
error (which is represented by 2).  
 
file.exe 1>file.log 2>&1  
send the standard output from file.exe into the file.log and also  
sends standard error into file.log (where standard out is going and  
hence the 2>&1 )  
 
 
Another example is  
fc /b file1.txt file2.txt 1>nul 2>file.txt  
where the normal text is redirected to NUL and errors are saved in  
file.txt  
 
Note that in all cases the 1 is optional and is the default where no  
numeral is used with redirection.  
 
One could use this too, when appending to files:  
batch.cmd 1>>output.log 2>>error.log


http://www.nabble.com/Stdout,-stde [...] 55405.html
 
C'est une bonne explication je trouve.

n°1559304
webding
Posté le 12-05-2007 à 08:40:43  profilanswer
 

Ta essayer comme ca:
For %%i in ("G:\test\"*.*) do if exist "H:\HS\"%%~nxi move /y %%i "G:\KL-85\" >> FICHIERSORTI.TXT


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Shell/Batch

  redirection de fichier (ajout)

 

Sujets relatifs
Comment uploader un fichier sur un ftp???upload de plusieurs fichier en php
Récupérer la taille de chaque fichier d'une BDDCréer e modifier un fichier excel en C#
description d'un fichier hexadecimalVoir et éditer les propriétés d'un fichier pdf
aide recuperation donnees d'un fichier texterenommer un fichier uploadé
[html] executer ou pas le fichier index.htm 
Plus de sujets relatifs à : redirection de fichier (ajout)


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR