All Questions
10
questions
0
votes
1
answer
1k
views
How can I run a batch file in an isolated environment? [closed]
Changes to the environment made by a batch file persist in the calling cmd.exe's environment.
Assume set.bat:
SET MYVAR=42
Then in cmd.exe, I type and see:
C:\Users\Me>.\set.bat
C:\Users\Me>...
1
vote
1
answer
2k
views
Windows: How to save a variable -(input: path) to text file
I'm trying to save a variable to text file, but i'm failing:
:folder
echo. && echo Where is your folder ?
set /p userinputpath = Type input[Drive][Path]:
echo "%userinputpath%" >> ...
2
votes
0
answers
27
views
impossible to open .bat files by double clicking: can't find file [duplicate]
My problem is that when i double click a .bat file it doesn't get opened by cmd and i get this error message:
"Windows cannot find 'C:\users\ (my name)\Desktop\test.bat'. Make sure you typed the ...
0
votes
0
answers
38
views
Setting an Environment Value in a FOR Loop [duplicate]
I wrote this code:
set list1=This,Is,A,List
set list2=
FOR %%c IN (%list1%) DO set list2=%list2%-%%c
I expected list2 to equal -This-Is-A-List, instead it equals -List. I have verified that it is ...
0
votes
0
answers
49
views
Command prompt. Is it possible to create a certain number of variables according to the lines in a text file and then
Can we use a text file to set variables according to how many changing lines are there in the .txt file?
files.txt
name 1
text 2
info 3
... and so on
set line01="name 1"
set line02="text 2"
...
0
votes
3
answers
4k
views
how to use output as VARIABLE and put trimmed value into CLIP?
can anyone teach me the right way? here is my attempt code:
@echo off
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
"%~dp0..\x64\mediainfo.exe" --Inform=General;%%UniqueID/String%% "%~dp0..\files\...
1
vote
1
answer
232
views
Can I use a batch file to hilight a specific file format?
I've been experimenting with batch files lately, and recently I found an answer to an old question: Hilight/select a file with a batch script. Now that I have accomplished that, I would like to know ...
1
vote
3
answers
6k
views
What does hyphen mean in Windows batch file?
In particular, I have problems understanding the hyphens in the following lines, which are from wikibooks
if not -%1-==-- echo Argument one provided
if -%1-==-- echo Argument one not provided & ...
0
votes
1
answer
249
views
Is there a way to reverse lookup which executable is being called?
I have multiple JDK's installed on my machine and I'm running on a system that has a pretty long path environment variable. Is there a way to see what my call to java resolves to?
I'm looking for ...
1
vote
2
answers
3k
views
How put path changing .bat file inside %PATH%?
I have a problem described here (you can read it for better understanding). I need to write .bat file that change path.
For example:
While sending a command in cmd: cd ~
I want to go to %HOMEPATH%. ...