Jump to content
echo Deletion of temporary files is complete, but it is required that you restart your computer. Would you like to restart now?[Y/N]
choice /c YN
if %errorlevel%== Y goto Shutdown
if %errorlevel%== N goto NoThanks

:Shutdown

shutdown -r -t 999
exit

:NoThanks
exit

It initiates restart no matter the choice. any idea why?

Favorite Threads: PSU Tier List

 

My Stuff n' Things

Spoiler

The Beast (My Rig)   |CPU: AMD Ryzen 7 7800X3D|  |Cooling: Noctus NHU12S Redux, 6x 120mm Noctua Redux|  |Motherboard:  Asus TUF B650-E WiFi|  |RAM: 4x8gb 6000 Corsair VENGEANCE RGB|  |Graphics Card: EVGA(RIP) GeForce RTX 3070TI FTW3|  |Power Supply: EVGA GT 850W|  |Case: Corsair 4000D Airflow Mid Tower Case(Black)|  |SSD: 1Tb SK Hynix Platinum P41 NVMe, 2Tb Inland Prime NVMe, 500gb Inland 2.5", 4tb WD Blue HDD|  |Monitor: MSI Optix MPG341QR 34" Ultrawide|  |Keyboard: Logitech G815|  |Mouse: Logitech G305|  |Audio Interface: FiiO K7 DAC/Amp|  |Headphones: Sennheiser HD6XX |Webcam: Logitech C920, Logitech C270|

 

My Network Rack  |Switch: Cisco Dell PowerConnect 5548P|  |Router: Unifi USG|  |Rack: 12U|  |Server: HP Z420|  |Services: Proxmox PVE, Wireguard, Pihole, NVR, NAS|

 

Link to comment
https://linustechtips.com/topic/1025424-batch-not-working/
Share on other sites

Link to post
Share on other sites

4 minutes ago, Braxlaw said:

I would suggest that you remove the empty line after :Shutdown ;)

same thing

Favorite Threads: PSU Tier List

 

My Stuff n' Things

Spoiler

The Beast (My Rig)   |CPU: AMD Ryzen 7 7800X3D|  |Cooling: Noctus NHU12S Redux, 6x 120mm Noctua Redux|  |Motherboard:  Asus TUF B650-E WiFi|  |RAM: 4x8gb 6000 Corsair VENGEANCE RGB|  |Graphics Card: EVGA(RIP) GeForce RTX 3070TI FTW3|  |Power Supply: EVGA GT 850W|  |Case: Corsair 4000D Airflow Mid Tower Case(Black)|  |SSD: 1Tb SK Hynix Platinum P41 NVMe, 2Tb Inland Prime NVMe, 500gb Inland 2.5", 4tb WD Blue HDD|  |Monitor: MSI Optix MPG341QR 34" Ultrawide|  |Keyboard: Logitech G815|  |Mouse: Logitech G305|  |Audio Interface: FiiO K7 DAC/Amp|  |Headphones: Sennheiser HD6XX |Webcam: Logitech C920, Logitech C270|

 

My Network Rack  |Switch: Cisco Dell PowerConnect 5548P|  |Router: Unifi USG|  |Rack: 12U|  |Server: HP Z420|  |Services: Proxmox PVE, Wireguard, Pihole, NVR, NAS|

 

Link to comment
https://linustechtips.com/topic/1025424-batch-not-working/#findComment-12228395
Share on other sites

Link to post
Share on other sites

@echo off
echo Are You Sure?[Y/N]
choice /c YN
if %errorlevel%== Y goto Tempdel
if %errorlevel%== N exit

:Tempdel
del /q/f/s %TEMP%\*

cls

echo Deletion of temporary files is complete, but it is required that you restart your computer. Would you like to restart now?[Y/N]
choice /c YN
if %errorlevel%== Y goto Shutdown
if %errorlevel%== N goto NoThanks

:Shutdown
shutdown -r -t 999
exit

:NoThanks
exit

exit

this is the whole thing

Favorite Threads: PSU Tier List

 

My Stuff n' Things

Spoiler

The Beast (My Rig)   |CPU: AMD Ryzen 7 7800X3D|  |Cooling: Noctus NHU12S Redux, 6x 120mm Noctua Redux|  |Motherboard:  Asus TUF B650-E WiFi|  |RAM: 4x8gb 6000 Corsair VENGEANCE RGB|  |Graphics Card: EVGA(RIP) GeForce RTX 3070TI FTW3|  |Power Supply: EVGA GT 850W|  |Case: Corsair 4000D Airflow Mid Tower Case(Black)|  |SSD: 1Tb SK Hynix Platinum P41 NVMe, 2Tb Inland Prime NVMe, 500gb Inland 2.5", 4tb WD Blue HDD|  |Monitor: MSI Optix MPG341QR 34" Ultrawide|  |Keyboard: Logitech G815|  |Mouse: Logitech G305|  |Audio Interface: FiiO K7 DAC/Amp|  |Headphones: Sennheiser HD6XX |Webcam: Logitech C920, Logitech C270|

 

My Network Rack  |Switch: Cisco Dell PowerConnect 5548P|  |Router: Unifi USG|  |Rack: 12U|  |Server: HP Z420|  |Services: Proxmox PVE, Wireguard, Pihole, NVR, NAS|

 

Link to comment
https://linustechtips.com/topic/1025424-batch-not-working/#findComment-12228403
Share on other sites

Link to post
Share on other sites

Ah and you need to change y/n to 1/2 in your if query.

Quote

The ERRORLEVEL is set to the offset of the index of the key that was selected from the set of choices.
The first choice listed returns a value of 1, the second a value of 2, and so on.

 

Link to comment
https://linustechtips.com/topic/1025424-batch-not-working/#findComment-12228407
Share on other sites

Link to post
Share on other sites

1 minute ago, Braxlaw said:

Ah and you need to change y/n to 1/2 in your if query.

 

so what should the new code be? my batch knowledge is all google lol

Favorite Threads: PSU Tier List

 

My Stuff n' Things

Spoiler

The Beast (My Rig)   |CPU: AMD Ryzen 7 7800X3D|  |Cooling: Noctus NHU12S Redux, 6x 120mm Noctua Redux|  |Motherboard:  Asus TUF B650-E WiFi|  |RAM: 4x8gb 6000 Corsair VENGEANCE RGB|  |Graphics Card: EVGA(RIP) GeForce RTX 3070TI FTW3|  |Power Supply: EVGA GT 850W|  |Case: Corsair 4000D Airflow Mid Tower Case(Black)|  |SSD: 1Tb SK Hynix Platinum P41 NVMe, 2Tb Inland Prime NVMe, 500gb Inland 2.5", 4tb WD Blue HDD|  |Monitor: MSI Optix MPG341QR 34" Ultrawide|  |Keyboard: Logitech G815|  |Mouse: Logitech G305|  |Audio Interface: FiiO K7 DAC/Amp|  |Headphones: Sennheiser HD6XX |Webcam: Logitech C920, Logitech C270|

 

My Network Rack  |Switch: Cisco Dell PowerConnect 5548P|  |Router: Unifi USG|  |Rack: 12U|  |Server: HP Z420|  |Services: Proxmox PVE, Wireguard, Pihole, NVR, NAS|

 

Link to comment
https://linustechtips.com/topic/1025424-batch-not-working/#findComment-12228414
Share on other sites

Link to post
Share on other sites

3 minutes ago, Braxlaw said:

 

THAT DID IT THANKS!!!!!

 

Favorite Threads: PSU Tier List

 

My Stuff n' Things

Spoiler

The Beast (My Rig)   |CPU: AMD Ryzen 7 7800X3D|  |Cooling: Noctus NHU12S Redux, 6x 120mm Noctua Redux|  |Motherboard:  Asus TUF B650-E WiFi|  |RAM: 4x8gb 6000 Corsair VENGEANCE RGB|  |Graphics Card: EVGA(RIP) GeForce RTX 3070TI FTW3|  |Power Supply: EVGA GT 850W|  |Case: Corsair 4000D Airflow Mid Tower Case(Black)|  |SSD: 1Tb SK Hynix Platinum P41 NVMe, 2Tb Inland Prime NVMe, 500gb Inland 2.5", 4tb WD Blue HDD|  |Monitor: MSI Optix MPG341QR 34" Ultrawide|  |Keyboard: Logitech G815|  |Mouse: Logitech G305|  |Audio Interface: FiiO K7 DAC/Amp|  |Headphones: Sennheiser HD6XX |Webcam: Logitech C920, Logitech C270|

 

My Network Rack  |Switch: Cisco Dell PowerConnect 5548P|  |Router: Unifi USG|  |Rack: 12U|  |Server: HP Z420|  |Services: Proxmox PVE, Wireguard, Pihole, NVR, NAS|

 

Link to comment
https://linustechtips.com/topic/1025424-batch-not-working/#findComment-12228438
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×