LostProphet91 Posted March 22, 2006 Share Posted March 22, 2006 Bonjour, je souhaite pouvoir copier un fichier du répoertoire courant vers le dossier application data de l'utilisateur dans un fichier batch. Cependant, le nom diffère selon les utilisateurs, et il me semblait que l'on pouvait utiliser cette commande: copy "fichier" %HOMEPATH%\Application Data\ Je suis tout neuf dans la programmation, donc je connais pas grand grand chose... et là la console de me dit que la synthaxe est incorrecte, vous pouvez m'aider? Merci! Link to comment Share on other sites More sharing options...
julienjb Posted March 22, 2006 Share Posted March 22, 2006 Tes % sont en trop...Mais pourquoi tu ne te sert pas de la variable " appdata" ? Link to comment Share on other sites More sharing options...
LostProphet91 Posted March 22, 2006 Author Share Posted March 22, 2006 Tes % sont en trop...Mais pourquoi tu ne te sert pas de la variable " appdata" ? Merci! Désolé mais, ça m'emmene où appdata? Par contre, en faisant cette ligne de commande, il me renomme le fichier en homepath, donc e voudrais savoir comment copier ce fichier dans le répertoire: C:\Documents and settings\le_nom_d'utilisateur\Application Data\ s'il vous plait... Link to comment Share on other sites More sharing options...
Sentinel Posted March 22, 2006 Share Posted March 22, 2006 Non non il faut bien garder les % Link to comment Share on other sites More sharing options...
LostProphet91 Posted March 22, 2006 Author Share Posted March 22, 2006 Il m'indique tout de même qu'il y a une erreur de synthaxe si je fais copy [fichier] %HOMEPATH%\Application Data Link to comment Share on other sites More sharing options...
Sentinel Posted March 22, 2006 Share Posted March 22, 2006 Bon il faudrait déjà savoir s'il existe bel et bien une variable d'environnement qui contient le répertoire utilisateur, sous windows... (Perso je peux pas te dire ça, j'ai pas windows) Link to comment Share on other sites More sharing options...
LostProphet91 Posted March 22, 2006 Author Share Posted March 22, 2006 Oui c'est vrai, mais je n'arrive pas à trouver un site répertoriant toutes ces variables persistantes... Link to comment Share on other sites More sharing options...
julienjb Posted March 22, 2006 Share Posted March 22, 2006 tu tape : "set" dans une ligne de commande et tu obtient : ALLUSERSPROFILE=C:\Documents and Settings\All Users APPDATA=C:\Documents and Settings\julien\Application Data CLASSPATH=C:\Program Files\QuickTime\QTSystem\QTJava.zip CLIENTNAME=Console CommonProgramFiles=C:\Program Files\Fichiers communs COMPUTERNAME=XXXX ComSpec=C:\WINDOWS\system32\cmd.exe HOMEDRIVE=C: HOMEPATH=\Documents and Settings\julien LOGONSERVER=\\XXXX NUMBER_OF_PROCESSORS=1 OS=Windows_NT Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\QuickTime\QTSystem\ PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH PROCESSOR_ARCHITECTURE=x86 PROCESSOR_IDENTIFIER=x86 Family 6 Model 8 Stepping 1, AuthenticAMD PROCESSOR_LEVEL=6 PROCESSOR_REVISION=0801 ProgramFiles=C:\Program Files PROMPT=$P$G QTJAVA=C:\Program Files\QuickTime\QTSystem\QTJava.zip SESSIONNAME=Console SystemDrive=C: SystemRoot=C:\WINDOWS TEMP=C:\DOCUME~1\julien\LOCALS~1\Temp TMP=C:\DOCUME~1\julien\LOCALS~1\Temp USERDOMAIN=MACHINE USERNAME=julien USERPROFILE=C:\Documents and Settings\julien windir=C:\WINDOWS Sers toi de la variable username , ce qui donne : copy "tonfichier" C:\"Documents and Settings"\%username%\"Application Data" Ne pas oublier les guillemets , windows n aime pas les espaces ..... Link to comment Share on other sites More sharing options...
LostProphet91 Posted March 23, 2006 Author Share Posted March 23, 2006 Un grand merci à toi Julienjb et vous tous!!! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.