Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I made and tested simple batch script to launch one of two applications in windows 10 using the CHOICE attribute with a 30 second timeout and one START function set as the default.
I moved my batch file over to my target thin client running windows 7 embedded standard and upon executing i realized that WES7 does not support the choice command. I need this to be as simple as possible with just one button use (no enter key) but I'm struggling to figure out my alternatives here. Here is the batch i was using.
#ECHO OFF
CLS
ECHO =============
ECHO 1.first app
ECHO 2.second app
ECHO.
CHOICE /C 12 /T 30 /D 1 /M "Enter your choice by pressing 1 or 2:"
:: Note - list ERRORLEVELS in decreasing order
IF ERRORLEVEL 2 GOTO app2
IF ERRORLEVEL 1 GOTO app1
:app1
ECHO running app1
START app1.exe
goto begin
:app2
ECHO running app2
START app2.exe
goto begin
:End
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I would like to delete all empty folders in a folder without having to open all of them. Unfortunately the size is not displayed next to the folder name. I already tried to adjust it under "options" but it is still not working.
Would anyone know how to do display the size?
Thank you!
You might try using tree function: on my PC I have created three subfolders and only one of them contains a file. The result of the tree command looks as follows:
C:\Temp_Folder>tree /F /A
Folder PATH listing
Volume serial number is 261B-B97E
C:.
| Ga_van_A_naar_B_in_de_VS.png
| landen
|
+---tralala
| test.txt
|
+---tralalala
\---tralalalala
As you see, when the next directory comes directly on the next line, this means your directory is empty (you need /F to see the files inside the directories for verifying they're empty or not).
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I made a batch file which contains:-
set /p ytlink="Enter the link of Youtube Video:- "
youtube-dl -f "bestvideo[height<=1080]+bestaudio/best[height<=1080]" ytlink
pause
But the output i got is:-
ERROR: 'ytlink' is not a valid URL. Set --default-search "ytsearch" (or run youtube-dl "ytsearch:ytlink" ) to search YouTube
My aim is to make a batch file in which i can enter youtube link which it will download.
You currently simply pass the text ytlink to youtube-dl. To pass the content of the ytlink variable, use %ytlink%.
set /p ytlink="Enter the link of Youtube Video:- "
youtube-dl -f "bestvideo[height<=1080]+bestaudio/best[height<=1080]" %ytlink%
pause
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I'm trying to create a batch file where it will find all the current drives on the computer and set the drives as variables to be called later. Thanks in advance.
This should do it
#echo off
setlocal EnableDelayedExpansion
set count=1
for /f "skip=1" %%a in ('wmic logicaldisk get caption') do (
set drive!count!=%%a
set /a count+=1
)
echo There are !count! drives
echo !drive1! rem Change this to do whatever with the variables
echo !drive2!
pause
I only showed echoing 2 drives, but, how many you have determines how many variables are created.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
Basically I wrote a very very simple batch script to shorten the opening of Notepad++. It accepts a single argument which it passes to Notepad++. The file is named npp.bat and is located in System32 and contains the commands:
#ECHO off
Notepad++ %1
As you can see, extremely simple, but it works as intended. However this is the first case I've had where a batch file retains control of the command line. It doesn't allow any more input until Notepad++ closes.
Basically what I'm wondering is if there is a Windows equivalent of the ampersand (&) operator in Linux
put start at the end!
#ECHO off
start "X" Notepad++ %1
start launches programs (and documents, and URLs) in a separate process
the "X" paramter is not actually needed in this example. start takes the first parameter if it's a quoted string as a window title for console applications, so if your are trying to run a command with spaces in the file name has spaces it'll get quotes and start has to see find something else first or it will steal the filename.
If you do start "c:\users\yourself\documents and settings\test one.doc" start will open a cmd window with the title c:\users\yourself\documents and settings\test one.doc instead of opening the document, start "X" "c:\users\yourself\documents and settings\test one.doc" will open the document.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I'm using boxcutter and take screenshots via command line. I want a loop that runs for 4 hours and takes screenshots every 10 seconds. I CAN NOT get a .bat to do this. First, I can't figure out how to make the script sleep for 10 seconds. Below is my code and no matter what variation I try my prompt just flashes quickly and is gone, yes I have used some choice words on this gem.
ECHO ON
for /l %i in (1,1,10) do
E:\boxcutter\boxcutter.exe -f E:\screenshots\%i.png
ping -n 10 someserver.com
done
pause
Any help is appreciated.
Try this instead:
for /l %%i in (1,1,1440) do (
E:\boxcutter\boxcutter.exe -f E:\screenshots\%%i.png
ping -n 10 localhost>nul
)
pause
This will take screenshots 10 seconds apart for 1440 iterations (which is 4 hours). Note that I doubled the percent signs in the for loop since this is running in a batch file, and I corrected the syntax for for...do...
You'll find it much easier to troubleshoot batch files if you open a command prompt and run them from there rather than double-clicking them from Windows Explorer. The command prompt will stay open rather than flashing briefly and disappearing.