Tagged Questions
0
votes
2answers
17 views
saving output as variable
I am working on a batch script and am trying to save part of the output of a command as a variable. My current script requires the user to enter a site code (e.g. 853), and it takes that code and uses ...
0
votes
1answer
50 views
Passing variables between batch file and .sql file for mssql server
I am attempting to create a batch file in windows that will take a user's input, and pass that along to a sql file containing the following query, so that I can set a siteid, like in the following sql ...
0
votes
2answers
40 views
for command variable unexpected at this time
dxdiag /t output.txt
FOR %%GeForce IN output.txt DO echo You have an NVIDIA GPU.
FOR %%Radeon IN output.txt DO echo You have an AMD GPU.
The above is a snippet of a batch file I created. When I run ...
0
votes
1answer
22 views
I am trying to write a batch that pulls variables from 2 text files
I am trying to write a batch that pulls variables from 2 text files. So far I can only get one variable working from one text file at a time.
I need to set variables for a remote PC name, and the ...
0
votes
1answer
19 views
Case sensitive variable within .bat file
I have an extremely simple batch file with a very annoying problem. I am trying to stop a process via its TASKKILL using it's image name (/IM). The problem is I have two image names that are the same ...
0
votes
2answers
35 views
How to create nested variables in batch?
I am trying to get nested variables in my batch game i am creating.
I want it so that it will choose a random variable and change it to X, but if it is already chosen, it should go back and choose a ...
0
votes
1answer
21 views
Recalling variables in a command prompt loop
I am setting a number of variables using the for /f command.
setlocal ENABLEDELAYEDEXPANSION
set vidx=0
for /F "tokens=*" %%A in (target_list.txt) do (
SET /A vidx=!vidx! + 1
SET ...
0
votes
3answers
34 views
How to split an ip address into seperate octets and perform arithmetic in cmd
What I am trying to do is configure some vlan scopes via cmd. What I have accomplished so far is to retrieve the IP Address of the Domain Controller and remove the space in front of the value. I ...
0
votes
1answer
32 views
Batch: How to append the name of a variable instead of the value of that variable
I am trying to append strings to a text file. So far, my code looks like this:
echo -%appointment% >>C:\Users\Evan\Desktop\Programming\Events.txt
echo set /a h=(%hours%*3600)+(%minutes%*60) ...
0
votes
1answer
48 views
Unreliable results using quotes with variables in windows batch for loop
I'm running a for loop to go through a list of services to stop, but I'm having trouble with the quotes, and rather unusual results as well.
for /f "tokens=* delims= " %%a in ('wmic service where ...
1
vote
4answers
58 views
batch variable nested into a batch variable
Depending on the text after 'X' and before 'Open file' in mypath variable, I want to call a function passing this text as argument in order to replace it by 'foo'. To do it, I have written
@echo off
...
0
votes
0answers
26 views
Batch DIR and VAR
I am currently working on a "advanced" batch script, just to keep my mind to something.
What i am trying to make is a (as far as its possible to make one) Bot script that includes the following ...
0
votes
2answers
48 views
Issue with a variable in my batch script
I want my script to:
Accept a variable
Create a path using that variable as input
Display the path
Display the contents of the directory
What is wrong with the following code? The ECHO statement ...
0
votes
1answer
26 views
Is it possible to call multiple batch files at once from a batch file? [duplicate]
So, i need to call multiple batch files, each containing one variable, all at once, so i can activate multiple variables at once.
Can you help me? If it is possible, what's the code for it?
0
votes
2answers
52 views
Nested environment variables
I am trying to make a file that asks for your username and password, with a registration. When registering, the passwords are saved in variables.
The problem is i have to set names for those ...