hidden hit counter
Help!

Problème de syntaxe

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> MS DOS Apps RSS
Next:  Delete command help  
Author Message
Guillaume MARANDE
External


Since: Dec 09, 2005
Posts: 2



PostPosted: Fri Dec 09, 2005 10:14 am    Post subject: Problème de syntaxe
Archived from groups: microsoft>public>win95>msdosapps (more info?)

Bonjour,

Voilà mon problème :

J'ai un fichier bat où j'ai ceci dedans :

rem ******************************************
rem * Sauvegarde des fichiers pour Mageco *
rem ******************************************


rem @echo off
cd\
cls

setlocal


::Change these as necessary
set Source=H:\Soustrai\Mageco\Envoi\
set Dest=H:\Soustrai\Mageco\Envoi\Sauve\

if "%Source:~-1%" NEQ "\" set Source=%Source%\
if "%Dest:~-1%" NEQ "\" set Dest=%Dest%\

if not exist %Source% goto :Error
if not exist %Dest% goto :Error

set Today=%date:~0,2%%date:~3,2%%date:~6,4%

for %%z in (%Source%*.*) do call :ProcessFile "%%z"

goto :eof
:ProcessFile
set FilePath=%~1
set FileName=%~n1
set FileExt=%~x1

::Remove the echo from the next line to do the actual copy

copy "%FilePath%" "%Dest%%FileName%_%Today%%FileExt%"
c:
cd\


goto :eof

:Error
echo Either the source or destination directory does not exist


Quand je l'exécute à partir de WXP Pro cela fonctionne, mais dès que je le
passe sur un PC W98, il me m'ait des erreurs de syntaxes.

Quelqu'un pourrait-il m'aider ?

Merci d'avance.

Guillaume MARANDE
Back to top
---DGI972---
External


Since: Dec 09, 2005
Posts: 1



PostPosted: Fri Dec 09, 2005 10:14 am    Post subject: Re: Problème_de_syntaxe [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Guillaume MARANDE a utilisé son clavier pour écrire :
> Bonjour,
>
> Voilà mon problème :
>
> J'ai un fichier bat où j'ai ceci dedans :
>
> rem ******************************************
> rem * Sauvegarde des fichiers pour Mageco *
> rem ******************************************
>
>
> rem @echo off
> cd\
> cls
>
> setlocal
>
>
> ::Change these as necessary
> set Source=H:\Soustrai\Mageco\Envoi\
> set Dest=H:\Soustrai\Mageco\Envoi\Sauve\
>
> if "%Source:~-1%" NEQ "" set Source=%Source%\
> if "%Dest:~-1%" NEQ "" set Dest=%Dest%\
>
> if not exist %Source% goto :Error
> if not exist %Dest% goto :Error
>
> set Today=%date:~0,2%%date:~3,2%%date:~6,4%
>
> for %%z in (%Source%*.*) do call :ProcessFile "%%z"
>
> goto :eof
> :ProcessFile
> set FilePath=%~1
> set FileName=%~n1
> set FileExt=%~x1
>
> ::Remove the echo from the next line to do the actual copy
>
> copy "%FilePath%" "%Dest%%FileName%_%Today%%FileExt%"
> c:
> cd\
>
>
> goto :eof
>
> :Error
> echo Either the source or destination directory does not exist
>
>
> Quand je l'exécute à partir de WXP Pro cela fonctionne, mais dès que je le
> passe sur un PC W98, il me m'ait des erreurs de syntaxes.
>
> Quelqu'un pourrait-il m'aider ?
>
> Merci d'avance.
>
> Guillaume MARANDE

Bonjour,
Il faut faire attention selon l'OS sur le format de la date dans la
ligne:
set Today=%date:~0,2%%date:~3,2%%date:~6,4%
Je me suis déjà fait avoir plusieur fois.
Bon courage
Back to top
Guillaume MARANDE
External


Since: Dec 09, 2005
Posts: 2



PostPosted: Fri Dec 09, 2005 4:02 pm    Post subject: Re: Problème de syntaxe [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Peux-tu me donner ta solution ?

Merci de ton aide.

Guillaume


"---DGI972---" <gilles.dermigny@*NOSPAM*laposte.net> a écrit dans le message
de news: mn.4a397d5c1901d45c.33554 RemoveThis @NOSPAMlaposte.net...
> Guillaume MARANDE a utilisé son clavier pour écrire :
>> Bonjour,
>>
>> Voilà mon problème :
>>
>> J'ai un fichier bat où j'ai ceci dedans :
>>
>> rem ******************************************
>> rem * Sauvegarde des fichiers pour Mageco *
>> rem ******************************************
>>
>>
>> rem @echo off
>> cd\
>> cls
>>
>> setlocal
>>
>>
>> ::Change these as necessary
>> set Source=H:\Soustrai\Mageco\Envoi\
>> set Dest=H:\Soustrai\Mageco\Envoi\Sauve\
>>
>> if "%Source:~-1%" NEQ "" set Source=%Source%\
>> if "%Dest:~-1%" NEQ "" set Dest=%Dest%\
>>
>> if not exist %Source% goto :Error
>> if not exist %Dest% goto :Error
>>
>> set Today=%date:~0,2%%date:~3,2%%date:~6,4%
>>
>> for %%z in (%Source%*.*) do call :ProcessFile "%%z"
>>
>> goto :eof
>> :ProcessFile
>> set FilePath=%~1
>> set FileName=%~n1
>> set FileExt=%~x1
>>
>> ::Remove the echo from the next line to do the actual copy
>>
>> copy "%FilePath%" "%Dest%%FileName%_%Today%%FileExt%"
>> c:
>> cd\
>>
>>
>> goto :eof
>>
>> :Error
>> echo Either the source or destination directory does not exist
>>
>>
>> Quand je l'exécute à partir de WXP Pro cela fonctionne, mais dès que je
>> le passe sur un PC W98, il me m'ait des erreurs de syntaxes.
>>
>> Quelqu'un pourrait-il m'aider ?
>>
>> Merci d'avance.
>>
>> Guillaume MARANDE
>
> Bonjour,
> Il faut faire attention selon l'OS sur le format de la date dans la ligne:
> set Today=%date:~0,2%%date:~3,2%%date:~6,4%
> Je me suis déjà fait avoir plusieur fois.
> Bon courage
>
>
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> MS DOS Apps All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum