Command Choice In a IF
Posted: 21 Jan 2013 13:23
Hi ! Sorry for my bad english, but I am a french canadian, This is why there is some part of my code in french!
I am trying to make a script for the school, Its in windows server 2008. Everything works fine alone. I mean that my command choice works, if I don't put it in the if, and my if work, if I try with an "echo Enter choice command here"
Here the code :
Here the choice !
I am trying to make a script for the school, Its in windows server 2008. Everything works fine alone. I mean that my command choice works, if I don't put it in the if, and my if work, if I try with an "echo Enter choice command here"
Here the code :
Code: Select all
@echo off
set corbeille=c:\corbeille
if "%1"=="" ( goto:eof )
cd %corbeille% || del %corbeille% >nul REM YOU CANNOT TEST A FOLDER WITH \nul IN WIN SERVER 2008 THIS COMMAND IS UGLY BUT THIS IS WHAT I FOUND
if NOT EXIST %corbeille% ( mkdir %corbeille% )
for %%A in (%*) do if EXIST %%A (
if EXIST %corbeille%\%%~nxA (
echo choice command here
) ELSE (
move %%A %corbeille% > nul
Shift )
) ELSE (
ECHO le fichier %%A n'existe pas, donc il n'a pas ete deplace
)
Here the choice !
Code: Select all
@echo off
choice /c ON /t 10 /d N /m "oui ou non"
IF ERRORLEVEL 2 GOTO non
IF ERRORLEVEL 1 GOTO oui
:non
echo il a dit non
GOTO end
:oui
echo IL A DIT OUI
:end