Batch inser caracteres debut ligne fich csv

Fermé
Lol42 Messages postés 10 Date d'inscription mercredi 2 mai 2012 Statut Membre Dernière intervention 4 mai 2012 - 4 mai 2012 à 16:21
 Willorca - 16 sept. 2013 à 11:59
Bonjour,

J'ai besoin de votre aide pour écrire un batch qui insérerait une chaine de caractères au début de chaque ligne non vide de mon fichier csv.

Mon fichier csv ressemble pour l'instant à ça:

7-Zip
AddressBook
Anooki v6-4
Connection Manager
DirectDrawEx
Fontcore
Foxit Reader_is1
HP Keyboard_is1
HP Remote Solution
.
.
.
InstallShield_{758C8301-2696-4855-AF45-534B1200980A}


Et j'ai besoin qu'il devienne ça:

%COMPUTERNAME%,20120000,7-Zip
%COMPUTERNAME%,20120000,AddressBook
%COMPUTERNAME%,20120000,Anooki v6-4
%COMPUTERNAME%,20120000,Connection Manager
%COMPUTERNAME%,20120000,DirectDrawEx
%COMPUTERNAME%,20120000,Fontcore
%COMPUTERNAME%,20120000,Foxit Reader_is1
%COMPUTERNAME%,20120000,HP Keyboard_is1
%COMPUTERNAME%,20120000,HP Remote Solution
.
.
.
%COMPUTERNAME%,20120000,InstallShield_{758C8301-2696-4855-AF45-534B1200980A}

(Avec %COMPUTERNAME% le nom du PC sur lequel le batch est exécuté, bien sûr)


Tout ceci avec un simple .bat

Quelqu'un saurait-il comment faire??

Merci!
A voir également:

1 réponse

dubcek Messages postés 18718 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 22 mars 2024 5 615
4 mai 2012 à 17:08
hello
@echo off
for /f "delims=" %%a in ('type fichier.csv') do (
	echo %COMPUTERNAME%,20120000,%%a
)
1
Lol42 Messages postés 10 Date d'inscription mercredi 2 mai 2012 Statut Membre Dernière intervention 4 mai 2012
4 mai 2012 à 17:10
AU TOP!!!

Merci merci merci merci! :)
0
Pareil, au TOP TOP, merci
0