Questions tagged [batch-file]

A batch file is a text file containing a series of commands that are executed by the command interpreter on MS-DOS, IBM OS/2, or Microsoft Windows systems.

Filter by
Sorted by
Tagged with
0
votes
0answers
11 views

How to i generate a random string from a *.txt when press enter [closed]

i'm teaching chinese tuition to kids. Due to current covid pandamic, we had changed to zoom teaching. I have a file with chinese words for student to read. Student is able to read 1 to 20 having no ...
0
votes
0answers
15 views

How can I create multiple URL shortcuts programmatically? [closed]

I have a client who needs about 16 different URL shortcuts on every desktop. It is tedious to create every one separately, especially considering they have nearly a hundred Win 10 users. Is there any ...
0
votes
2answers
40 views

How to use ADB in a Batch file to open a Windows File Explorer window

I tried posting this on Stack but was told it may be more appropriate here. I'm trying to run a bat that will open a folder on an android device using ADB in Windows. For the life of me I have ...
1
vote
0answers
29 views

How to create a batch script for mouse movement to prevent MS Teams status away? [closed]

Looks like MS Teams does not provide a way to set duration for showing away as described in https://superuser.com/a/1621012/849717. How to create a batch script to periodically move mouse, say a ...
0
votes
1answer
35 views

Batch rename files with multiple extensions

This has been driving me crazy for quite a while. I have files with multiple useless extensions in the filename. For example, batch-converting from MP4 to MP3 via command-line:- cd /d "%1" ...
0
votes
3answers
90 views

Task Scheduler always launches applications in background. How to launch in foreground?

It is a problem I encountered in Windows 10 task scheduler. I created a basic task whose action is start a batch file as follows: start "BitComet" "C:\Program Files\BitComet\BitComet....
0
votes
0answers
23 views

What is wrong with this CMD batchfile containing “FOR” and “SCHTASKS”?

I have created the below batchfile named "foobar.bat", using functioning code for the command from here: TIMEOUT 2 Echo Hello World For /F "Tokens=1*Delims=\" %# In ('%SystemRoot%\...
5
votes
2answers
562 views

How to use a path with spaces in the batch file? [duplicate]

I have a simple Win 10 batch script to open a bunch of folders within Explorer at system startup, however there's a problem with the last command's path containing whitespaces, as instead of opening a ...
0
votes
0answers
36 views

Windows Registry Query Problems

i trying to query the wifi registry ProfileName under this path HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles as Wifi_5G i want to change the profilename to ...
0
votes
1answer
27 views

Userid variable issue

I got 2 commands issue if let say my userid = testing computer it will grab testing instead of testing computer. If my userid = testing i have no issue with it. Anyone can assist how can i fix this to ...
1
vote
2answers
47 views

How to check for the existence of a folder in a given relative path?

I am trying to see if a specific folder exists as a sub folder in a certain path. Assume a path given in a variable InputPath and a relative path given RelPath.  How can I write a block to look if a ...
2
votes
1answer
40 views

Task Scheduler .bat file creating wrong folder, while manually running it creating correct folder

When I am running .bat file manually it is creating the right folder, but when same file I am scheduling and running through Task Scheduler it is not creating folder as expected. Below is the main ...
0
votes
1answer
36 views

Why is the value of `%profile%` not immediately available after `set /P profile=“sas-admin profile:”`?

I have a batch (*.bat) file that should login to a server. These are a few of the lines in it: set /P token_user=": SAS token account (srvglobalff...) :" echo token user is %token_user% ...
2
votes
0answers
52 views

batch file to restart WIndows 10 in safe mode with (or without) network?

How can I create a batch file to to restart Windows 10 in safe mode with or without network? I see many solutions here and in other website, but I just want a batch file that I run and the laptop ...
2
votes
0answers
50 views

How can I use the Windows Console to find out which processes on my computer are accessing the microphone?

I'd like to create a small Batch script that only runs my audio mixing software (NVIDIA Broadcast & Voicemeeter) if there's a program actively using the microphone. For this I need to somehow ...
0
votes
1answer
31 views

Trying to use net use and shutdown.exe command ERROR

Have three computers all part of the same workgroup so no domain. Two computers running Windows 8.1 Pro and the third computer is running Windows 10 Pro. I'm executing a batch file from one of the two ...
-1
votes
2answers
179 views

Extract the Absolute / Relative Path to a Folder Up in The Tree

I use the code Resolve Absolute Path from Relative Path and / or File Name in order to extract absolute path from relative path. Yet my question is how to extract the relative / absolute path of a ...
1
vote
1answer
27 views

Wrong errorlevel inside parenthesis in Windows batch script

Here is a windows .bat file: @echo off call :label echo %errorlevel% pause >nul exit :label exit /b 1 Works as expected and outputs 1. but on changing the code to: @echo off if 1==1 ( call :...
1
vote
1answer
47 views

After automatic PuTTY login, getting only dollar sign as shell prompt in terminal

When I am doing automatic PuTTY login from Windows bat file, after login command prompt is showing only dollar sign in UNIX terminal. But when I am doing manual login in PuTTY, after login, it is ...
-1
votes
2answers
35 views

How can i edit this Batch File? [closed]

I have downloaded a .Bat file, it is a script that is used to import images (IOS) to the "Eve-NG" emulator, I have never worked with "Script" and neither with batch files. I would ...
1
vote
2answers
80 views

How to detect that a Windows application is running (no GUI)

Would like to have a suggestion on how to detect (preferably in such a way a batch file could use the result) whether a certain application is running so that some action could be taken. (Of course, ...
0
votes
2answers
81 views

How do I make a batch file recognize file extensions in For loop?

I'm trying to make a batch file, a newer one than the one I made last time, and I'm planning to add to my previous program, for organize all of the respective images it finds into folders ...
1
vote
0answers
23 views

How can I access Start Menu search functionality over RemoteApp?

I use RemoteApp on a daily basis for accessing remote applications using my local desktop window manager. This has worked very well for me, particularly while working from home during the current ...
1
vote
1answer
54 views

login to remote using “mstsc /admin” with password

I want to use mstsc /admin to login to a server silently. My batch file reads the code as set mysrvad=server_ip set mysrvid=id set mysrvpswd=pw cmdkey /generic:%mysrvad% /user:%mysrvid% /pass:%...
0
votes
2answers
40 views

Batch File; Run exe from Top folder of specified Directory

Question; Is there a way to direct this Batch file to the latest Version Folder (highest year) of AutoCAD 20xx found in the C:\Program Files\Autodesk\..? General Background; A number of staff run ...
0
votes
4answers
146 views

How to get a number out of a file name to use in cmd?

I have a bat file that automatically runs a server like this: cd %location_1%\target start java -jar cm-2.0.1.jar The name of the jar file will change for new releases: cm-2.0.2.jar cm-2.0.3.jar ...
0
votes
0answers
22 views

Bulk exif tags bat script not working peoperly

I have a batch script to set XMP:Subject Exif tags on pictures in bulk. tags.txt has all links of the pages and the tags. Links and Tags are separated by =. This script should divide the URL and Tags ...
0
votes
1answer
44 views

How do I make this code acknowledge spaces in a directory?

I want to make a file where it copies all images into a new folder in the current directory, except you can edit the file to get rid of directories like AppData or Program Files. Problem: it doesn't ...
1
vote
1answer
34 views

Copy first n hex of a file

You can output the first n hex bytes of a file in Linux with xdd (xdd -ps, etc) How would one do this on Windows, though? Is there a way?
1
vote
1answer
76 views

Get hard drive serial number based on drive letter on Windows Command Line (not Powershell) and store in variable

I know I can get the serial number of all listed hard drives by using: wmic diskdrive list brief or specifically wmic diskdrive get serialnumber And I can get the drive letter from the logical disk: ...
0
votes
1answer
22 views

How to insert text into a command inside a batch script

So I have a batch script and I would like the user to write something into the app. What I mean is, let's say the user has a batch script and the batch script would like to know the name of an app. ...
-2
votes
2answers
92 views

How can I enter the following batch file code directly on the command line [closed]

I would like to enter the following batch file code directly on the command line: setlocal enabledelayedexpansion set "type=.jpg" set "source=c:\" set "dest=c:\AllPics" ...
0
votes
2answers
398 views

How do I make a running and working batch file from a pre-made batch file?

So I am trying to make a batch file from a pre-made batch file and I don't know how to got to the next line in the file without ruining it and it just saying what I want the command to do. This is ...
0
votes
0answers
26 views

Will 'mouse.bat moveBy 1x1' keep the screen from locking in an RDP session if it's run under a different user?

I'm using this Mouse.bat batch file to keep my screen from locking after 15 minutes (it's enforced by Group Policy). I have it set as a scheduled task to run every 10 minutes and it works with my ...
3
votes
2answers
123 views

Unable to call ffmpeg in a batch file

I reencode a lot of video files with ffmpeg using the following command at the prompt: for %F in ("..\*.*") DO ffmpeg -n -i "%F" -c:v libx265 -c:a copy "%~nF.mkv" I ...
0
votes
1answer
45 views

Extract Information from Clipboard and return partial Information back to Clipboard

I'm need a small batch-file which should help me extract an Information from the clipboard an return a partial information to the clipboard. I have come so far: @setlocal enableextensions ...
2
votes
1answer
25 views

Sending email with powershell

I am trying to send an email with powershell which I can call from my bat file. Below is the code which I have right now but I get the error below. Send-MailMessage -From "arnedeconinck3@gmail....
0
votes
3answers
65 views

Confused about goto label (batch file) Windows

If I use these commands this way around, it does what it should: If foo was previously set as one thing or another, it skips to foobar_menu If foo was previously not set as (the same) one thing or ...
2
votes
1answer
195 views

Can this batch file damage/prevent Windows 10 from booting?

Is there anything in the below .bat script that could delete/corrupt any Windows 10 system files and prevent them from starting, causing a boot loop? After rebooting, following the execution of the ....
0
votes
2answers
73 views

what can i add To Scan Folders Using This Comment?

I use this to delete some Files in my Flash USB echo "Enter Drive letter" set /p driveletter= attrib -s -h -a /s /d %driveletter%:\*.* del %driveletter%:\*.lnk del %driveletter%:\*.vbe ...
0
votes
1answer
41 views

How do I add IP ranges in batch file after setting a command to set a IP Address

I've tried to use the set/p command to set the static IP address using the command below. But how do I include the add command which allows me to add multiple IP ranges in the Advance tab? Meaning my ...
0
votes
1answer
52 views

How to Start an exe from .bat file without tying up the command line

I am using SSH to command line into another computer and execute .bat scripts. (Windows 10). But when I run a batch file that has the following in it start c:\Program Files\qBittorrent\qbittorrent....
1
vote
1answer
36 views

Overwrite folder with Xcopy

I have a backup folder that i should copy it weekly , so i use a batch file in the task sheduler of Windows contains this line xcopy /s "C:\backupMai" "\\myserver\backup$\logFile\...
0
votes
0answers
15 views

Run a NON-ELEVATED command from an already elevated batch file in Windows 10 [duplicate]

I have a batch file that runs at startup with admin privileges (using Task Scheduler) and does some maintenance tasks. However, there is a problem. I have a certain maintenance task I need to do which ...
0
votes
0answers
14 views

How to enter a FDE passhprase in a key authenticated SSH session in Windows, using one click?

I want my grandma to unlock an encrypted Linux server when I can't. She knows nothing about Linux, SSH, asymmetric keys, passphrases, etc., but she knows how use the mouse to click on an icon. The ...
1
vote
1answer
101 views

How to get tab-initiated lines using Findstr /B [TAB] in Bat/CMD

There is an option that works in Unix & Linux: Like @jimmij answer command: grep -B2 '^\t' file. But is there an option using only bat/cmd with the Findstr command? Already tried.. Findstr /bl [...
0
votes
2answers
25 views

Batch File: Search All Directories Except These Directories

I have a line of code that looks like this, which loads all immediate directory names into Variable A, then continues on through the rest of the loop. for /d %%A in (*) do How can I change this such ...
0
votes
0answers
27 views

Making a Batch File a Service stops Taskkill from working?

I have a batch file that checks to see if a program is running and will kill it when the requirements have been met. It works just fine when I run the .bat file via cmd, but when I make it a service (...
0
votes
0answers
33 views

How do I properly sync data between two Windows 10 systems on the same LAN utilizing Robocopy, a .bat file, and Task Scheduler?

I've read a number of posts regarding the use of robocopy to sync data between two Windows systems. I tried various configurations, and the settings I currently have in place are what seemed to work ...
0
votes
1answer
30 views

finding a list of words as files in a directory

I have a list of files that I'm looking for in a directory. They are all JPG files. I need to know how to return a value which will only look once in the directory. This will be within an existing ...

1
2 3 4 5
54