Search found 1160 matches

by ShadowThief
02 Apr 2024 08:10
Forum: DOS Batch Forum
Topic: netsh Interface name store as variable
Replies: 3
Views: 11208

Re: netsh Interface name store as variable

Pipe a second findstr for "Ethernet"

Code: Select all

@echo off
for /f "tokens=3*" %%a in ('netsh interface show interface ^| findstr "Connected" ^| findstr "Ethernet"') do (
    set "AdapterName=%%b"
)
echo %AdapterName%
by ShadowThief
01 Apr 2024 16:31
Forum: DOS Batch Forum
Topic: what is the difference between 1> and 2>
Replies: 4
Views: 379

Re: what is the difference between 1> and 2>

2 is for errors (STDERR), 1 is for everything else (STDOUT)

It doesn't matter if you put it at the front or the back of the command you're using it on, although there are a few edge cases where putting it at the front is better.
by ShadowThief
22 Mar 2024 22:54
Forum: DOS Batch Forum
Topic: if/elseif dont work like expected...Sorry, this time in English
Replies: 3
Views: 268

Re: if/elseif dont work like expected...Sorry, this time in English

If that's the entire code, then you're missing the final )

You've also written cdm /k instead of cmd /k (although I don't see why you'd need that at all since it only spawns a child terminal process), but that throws a different error.
by ShadowThief
30 Jan 2024 13:41
Forum: DOS Batch Forum
Topic: SYSTEM account console 254 characters limit
Replies: 4
Views: 8322

Re: SYSTEM account console 254 characters limit

If you think you need the SYSTEM account for something, you're doing something wrong. If you need more than 254 characters for a single command, you're also doing something wrong. You haven't described your use case, so I'll just assume the standard reasons for shoving a bunch of code all at once at...
by ShadowThief
17 Jan 2024 13:26
Forum: DOS Batch Forum
Topic: Batch Parser
Replies: 2
Views: 3289

Re: Batch Parser

There's excellent documentation at https://stackoverflow.com/questions/409 ... se-scripts but I'm not aware of anything interactive.
by ShadowThief
07 Jan 2024 11:34
Forum: DOS Batch Forum
Topic: Is it worth learning Powershell?
Replies: 10
Views: 34703

Re: Is it worth learning Powershell?

I'm talking specifically about the language that uses the cscript and wscript interpreters. https://en.wikipedia.org/wiki/VBScript It's a scripting language for ActiveX that's modeled on Visual Basic and that I've used multiple times as standalone replacements for VBA macros that I've written. Wikip...
by ShadowThief
18 Nov 2023 19:25
Forum: DOS Batch Forum
Topic: The timeout command blocks the W key from closing CMD window
Replies: 3
Views: 16563

Re: The timeout command blocks the W key from closing CMD window

How could this be happening It's obviously a bug in the code. Nobody here is capable of elaborating further because Windows is closed source. more importantly: how to fix / workaround this issue? By pressing one of the 100+ other keys on the keyboard. This is such a non-issue that I'm surprised you...
by ShadowThief
05 Nov 2023 22:22
Forum: DOS Batch Forum
Topic: Problems working a script
Replies: 6
Views: 21025

Re: Problems working a script

That's just my answer, but with no explanations and posted here so they're going to see it even if they don't want to. The entire point of me posting it to pastebin was that this is very clearly a homework question and they asked for help and not a solution so they should have the option of not imme...
by ShadowThief
05 Nov 2023 18:21
Forum: DOS Batch Forum
Topic: Problems working a script
Replies: 6
Views: 21025

Re: Problems working a script

https://pastebin.com/Lh3gEWhL if you want answers rather than general guidance
by ShadowThief
05 Nov 2023 18:11
Forum: DOS Batch Forum
Topic: Problems working a script
Replies: 6
Views: 21025

Re: Problems working a script

The fact that you're saying that you haven't gotten it suggests to me that you have some way of validating the solution, and so this feels a bit like homework. Depending on your teacher's standards and whether or not you just didn't format the code when you pasted it in here, I could argue that ever...
by ShadowThief
03 Nov 2023 10:14
Forum: DOS Batch Forum
Topic: Is it worth learning Powershell?
Replies: 10
Views: 34703

Re: Is it worth learning Powershell?

I will just add this: I think PS is very good for (some?) admin repetive tasks (why I wrote 'some?'? - because I don't take care of servers but this is based on what I read so I don't have such experiences). I use PS almost daily for some special task: I have (my customer really) 150+ Excel files. ...
by ShadowThief
13 Oct 2023 03:31
Forum: DOS Batch Forum
Topic: variables as paths to run?
Replies: 2
Views: 12753

Re: variables as paths to run?

The /p flag is only meant for prompting the user for input, and you only need quotes around the assignment, not on each side of the equals sign - this isn't an if statement. set "windeployqt6=c:\Qt\6.6.0\mingw_64\bin\windeployqt6.exe" set "sourceDir=c:\Qt\Projects\Sources\game_test" set "appPath=c:\...
by ShadowThief
09 Oct 2023 22:44
Forum: DOS Batch Forum
Topic: Variable inside an IF not showing correctly
Replies: 18
Views: 103541

Re: Variable inside an IF not showing correctly

If you're seeing !variable! instead of its actual value, then you're missing setlocal enabledelayedexpansion from your script. If you're seeing !variable! and its value, then you need to add @echo off to the top of your script.