Bat Dosyası ile Evet Hayır Sorusu Sormak

Bilmemne

Hectopat
Katılım
27 Kasım 2014
Mesajlar
124
Çözümler
1
Daha fazla  
Cinsiyet
Erkek
Arkadaşlar başlıkta belirttiğim gibi bat dosyası ile nasıl evet hayır sorusu sorulur? Yanlış yerde konu açtıysam özür dilerim, en uygun burayı buldum.
 
Kod:
@ECHO OFF

:choice
set /P c=Devam etmek istedigine emin misin [E/H]?
if /I "%c%" EQU "E" goto :somewhere
if /I "%c%" EQU "H" goto :somewhere_else
goto :choice


:somewhere

echo "Ben buradayim zira sen Evet dedin."
pause
exit

:somewhere_else

echo "Ben buradayim cunku sen Hayir dedin."
pause
exit
 
Kod:
@ECHO OFF

:choice
set /P c=Devam etmek istedigine emin misin [E/H]?
if /I "%c%" EQU "E" goto :somewhere
if /I "%c%" EQU "H" goto :somewhere_else
goto :choice


:somewhere

echo "Ben buradayim zira sen Evet dedin."
pause
exit

:somewhere_else

echo "Ben buradayim cunku sen Hayir dedin."
pause
exit
Hocam bu kodu benim yaptığım koda ekleyince direk kapanıyor benim eklediğim kodları işlemiyor nasıl düzeltirim?
[CODE title="aa"]del /f /q /s "D:\Games\Zula\log\*.*
del /f /q /s "D:\Games\Zula\Game\logs\*.*
del /f /q /s "D:\Games\Zula\acklog.txt*.*
del /f /q /s "D:\Games\Zula\login.ini*.*
del /f /q /s "D:\Games\Zula\Screenshots\*.jpg
del /f /q /s %systemdrive%\*.old
del /f /s /q %systemdrive%\*._mp
del /f /q /s %systemdrive%\*.bak
del /f /q /s %systemdrive%\*.log
del /f /q /s %systemdrive%\*.tmp
del /f /q /s %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.gid
del /f /q /s %systemdrive%\RECYCLER\*.*
del /f /q /s %WinDir%\Temp\*.*
del /f /q /s %WinDir%\Prefetch\*.*
del /f /q /s %WinDir%\Driver Cache\i386\*.*
del /f /q /s %WinDir%\system32\dllcache\*.*
del /f /q /s %WinDir%\$hf_mig$\*.*
del /f /q /s %WinDir%\Driver Cache\*.*ll
del /f /q /s %WinDir%\addins\*.*
del /f /q /s %WinDir%\LastGood\*.*
del /f /q /s %WinDir%\Offline Web Pages\*.*
del /f /q /s %WinDir%\$NtServicePackUninstall$\*.*
del /f /q /s %WinDir%\Provisioning\*.*
del /f /q /s %WinDir%\ServicePackFiles\*.*
del /f /q /s %WinDir%\Web klasörü\*.*
del /f /q /s %WinDir%\Connection Wizard\*.*
del /f /q /s %WinDir%\EHome\*.*
del /f /q /s %WinDir%\Assembly\*.*
del /f /q /s %WinDir%\SoftwareDistribution\Download\*.*
del /f /q /s %WinDir%\mui\*.*
del /f /q /s %WinDir%\Config\*.*
del /f /q /s %WinDir%\msapps\*.*
del /f /s /q %winDir%\*.bak
del /f /q /s %userprofile%\AppData/Local/Temp\*.*
del /f /s /q %windir%\prefetch\*.*[/CODE]
Bu kodlar ile birleşecek.
 
Hocam bu kodu benim yaptığım koda ekleyince direk kapanıyor benim eklediğim kodları işlemiyor nasıl düzeltirim?
[CODE title="aa"]del /f /q /s "D:\Games\Zula\log\*.*
del /f /q /s "D:\Games\Zula\Game\logs\*.*
del /f /q /s "D:\Games\Zula\acklog.txt*.*
del /f /q /s "D:\Games\Zula\login.ini*.*
del /f /q /s "D:\Games\Zula\Screenshots\*.jpg
del /f /q /s %systemdrive%\*.old
del /f /s /q %systemdrive%\*._mp
del /f /q /s %systemdrive%\*.bak
del /f /q /s %systemdrive%\*.log
del /f /q /s %systemdrive%\*.tmp
del /f /q /s %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.gid
del /f /q /s %systemdrive%\RECYCLER\*.*
del /f /q /s %WinDir%\Temp\*.*
del /f /q /s %WinDir%\Prefetch\*.*
del /f /q /s %WinDir%\Driver Cache\i386\*.*
del /f /q /s %WinDir%\system32\dllcache\*.*
del /f /q /s %WinDir%\$hf_mig$\*.*
del /f /q /s %WinDir%\Driver Cache\*.*ll
del /f /q /s %WinDir%\addins\*.*
del /f /q /s %WinDir%\LastGood\*.*
del /f /q /s %WinDir%\Offline Web Pages\*.*
del /f /q /s %WinDir%\$NtServicePackUninstall$\*.*
del /f /q /s %WinDir%\Provisioning\*.*
del /f /q /s %WinDir%\ServicePackFiles\*.*
del /f /q /s %WinDir%\Web klasörü\*.*
del /f /q /s %WinDir%\Connection Wizard\*.*
del /f /q /s %WinDir%\EHome\*.*
del /f /q /s %WinDir%\Assembly\*.*
del /f /q /s %WinDir%\SoftwareDistribution\Download\*.*
del /f /q /s %WinDir%\mui\*.*
del /f /q /s %WinDir%\Config\*.*
del /f /q /s %WinDir%\msapps\*.*
del /f /s /q %winDir%\*.bak
del /f /q /s %userprofile%\AppData/Local/Temp\*.*
del /f /s /q %windir%\prefetch\*.*[/CODE]
Bu kodlar ile birleşecek.

Kod:
@ECHO OFF

:choice
set /P c=Devam etmek istedigine emin misin [E/H]?
if /I "%c%" EQU "E" goto :somewhere
if /I "%c%" EQU "H" goto :somewhere_else
goto :choice

:somewhere

echo "Ben buradayim zira sen Evet dedin."

del /f /q /s "D:\Games\Zula\log\*.*
del /f /q /s "D:\Games\Zula\Game\logs\*.*
del /f /q /s "D:\Games\Zula\acklog.txt*.*
del /f /q /s "D:\Games\Zula\login.ini*.*
del /f /q /s "D:\Games\Zula\Screenshots\*.jpg
del /f /q /s %systemdrive%\*.old
del /f /s /q %systemdrive%\*._mp
del /f /q /s %systemdrive%\*.bak
del /f /q /s %systemdrive%\*.log
del /f /q /s %systemdrive%\*.tmp
del /f /q /s %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.gid
del /f /q /s %systemdrive%\RECYCLER\*.*
del /f /q /s %WinDir%\Temp\*.*
del /f /q /s %WinDir%\Prefetch\*.*
del /f /q /s %WinDir%\Driver Cache\i386\*.*
del /f /q /s %WinDir%\system32\dllcache\*.*
del /f /q /s %WinDir%\$hf_mig$\*.*
del /f /q /s %WinDir%\Driver Cache\*.*ll
del /f /q /s %WinDir%\addins\*.*
del /f /q /s %WinDir%\LastGood\*.*
del /f /q /s %WinDir%\Offline Web Pages\*.*
del /f /q /s %WinDir%\$NtServicePackUninstall$\*.*
del /f /q /s %WinDir%\Provisioning\*.*
del /f /q /s %WinDir%\ServicePackFiles\*.*
del /f /q /s %WinDir%\Web klasörü\*.*
del /f /q /s %WinDir%\Connection Wizard\*.*
del /f /q /s %WinDir%\EHome\*.*
del /f /q /s %WinDir%\Assembly\*.*
del /f /q /s %WinDir%\SoftwareDistribution\Download\*.*
del /f /q /s %WinDir%\mui\*.*
del /f /q /s %WinDir%\Config\*.*
del /f /q /s %WinDir%\msapps\*.*
del /f /s /q %winDir%\*.bak
del /f /q /s %userprofile%\AppData/Local/Temp\*.*
del /f /s /q %windir%\prefetch\*.*

pause
exit

:somewhere_else

echo "Ben buradayim cunku sen Hayir dedin."
pause
exit

Bu şekilde çalışır.
Ama yönetici izni ister.


Kodların başına şunu da eklersen tahminen işini görür.
Kod:
@echo off
setlocal EnableDelayedExpansion

::net file to test privileges, 1>NUL redirects output, 2>NUL redirects errors
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto START ) else ( goto getPrivileges )

:getPrivileges
if '%1'=='ELEV' ( goto START )

set "batchPath=%~f0"
set "batchArgs=ELEV"

::Add quotes to the batch path, if needed
set "script=%0"
set script=%script:"=%
IF '%0'=='!script!' ( GOTO PathQuotesDone )
    set "batchPath=""%batchPath%"""
:PathQuotesDone

::Add quotes to the arguments, if needed.
:ArgLoop
IF '%1'=='' ( GOTO EndArgLoop ) else ( GOTO AddArg )
    :AddArg
    set "arg=%1"
    set arg=%arg:"=%
    IF '%1'=='!arg!' ( GOTO NoQuotes )
        set "batchArgs=%batchArgs% "%1""
        GOTO QuotesDone
        :NoQuotes
        set "batchArgs=%batchArgs% %1"
    :QuotesDone
    shift
    GOTO ArgLoop
:EndArgLoop

::Create and run the vb script to elevate the batch file
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
ECHO UAC.ShellExecute "cmd", "/c ""!batchPath! !batchArgs!""", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"
exit /B

:START
::Remove the elevation tag and set the correct working directory
IF '%1'=='ELEV' ( shift /1 )
cd /d %~dp0
 

Yeni konular

Geri
Yukarı