Search found 25 matches
- 18 Jan 2025 18:09
- Forum: DOS Batch Forum
- Topic: Use Netsh to save ip gw dns to variables for project
- Replies: 6
- Views: 6800
Re: Use Netsh to save ip gw dns to variables for project
Here is the batch snippet. I'd like to remove the - from the mac address and I'm planninig one writing to text. rem Get IP, Gatway, DNS for /f "tokens=3 delims=: " %%a in ('netsh interface ip show address "%conn%" ^| findstr "IP Address"') do set ip=%%a for /f "tokens=3 delims=: " %%b in ('netsh int...
- 17 Jan 2025 15:45
- Forum: DOS Batch Forum
- Topic: Use Netsh to save ip gw dns to variables for project
- Replies: 6
- Views: 6800
Re: Use Netsh to save ip gw dns to variables for project
I got almost everything I need except for MAC address from netsh I have been able to get mac from arp -a | find "ipaddress" and may have to stick with that but I'm trying to use netsh netsh -r \\ipaddress.... but I get that far and can't find commands for mac address for netsh -r \\ipaddress intefac...
- 15 Jan 2025 12:30
- Forum: DOS Batch Forum
- Topic: Use Netsh to save ip gw dns to variables for project
- Replies: 6
- Views: 6800
Re: Use Netsh to save ip gw dns to variables for project
I got DNS worked out. Title ===Find adapter name=== FOR /F "tokens=3,*" %%A IN ('netsh interface show interface^|find "Connected"') DO set conn=%%B rem Get IP, Gatway, DNS for /f "tokens=3 delims=: " %%a in ('netsh interface ip show address "%conn%" ^| findstr "IP Address"') do set IPAddress=%%a for...
- 15 Jan 2025 08:27
- Forum: DOS Batch Forum
- Topic: Use Netsh to save ip gw dns to variables for project
- Replies: 6
- Views: 6800
Re: Use Netsh to save ip gw dns to variables for project
I'm try to use DNS too. I found this; rem netsh interface ipv4 show dnsserver name="%conn%" netsh interface ipv4 show dnsserver name="%conn%" |findstr "Servers" for /f "tokens=3 delims=: " %%c in ('netsh interface ipv4 show dnsserver name="%conn%" ^| findstr "Servers"') do set ns=%%c echo Your DNS i...
- 11 Jan 2025 17:27
- Forum: DOS Batch Forum
- Topic: Use Netsh to save ip gw dns to variables for project
- Replies: 6
- Views: 6800
Use Netsh to save ip gw dns to variables for project
I can get these values from ipconfig, but can't sepcify the adapter I'm using. I've got some code to get these address but not to save them as variables I'm trying to save these address to variables to set the values so I can manually set/change IP address for several projects, Again, I can get the ...
- 19 Dec 2015 12:55
- Forum: DOS Batch Forum
- Topic: Stopping services, restarting services(safemode)
- Replies: 17
- Views: 17533
Re: Stopping services, restarting services(safemode)
To complete this topic, I created a batch that disables all but a few necessary services. It is similar to safe mode. It has been a great success and allows us to install programs to scan. An alternative we have found was a little utility that enabled services in safe mode to allow installations. We...
- 02 Feb 2015 19:35
- Forum: DOS Batch Forum
- Topic: Batch to kill installer process to move on with the script..
- Replies: 3
- Views: 4464
Re: Batch to kill installer process to move on with the scri
I did this several times when a program has a switch for silent install, then I learned to make a shortcut to the program and put the switches in the shortcut.
- 01 Feb 2015 17:44
- Forum: DOS Batch Forum
- Topic: Browse folder names only no path and put in text file
- Replies: 4
- Views: 4757
Re: Browse folder names only no path and put in text file
I figured it out! This gives me only the Folder name (no path) and saves it to a text file for later use. for /f "tokens=*" %%i in ('dir "%userprofile%\Documents\" /ad /b') do ( choice /c yn /m "Exclude Folder [%%i]? if errorlevel 2 else ( echo %%i>>%~dp0exclude.txt ) )
- 01 Feb 2015 15:58
- Forum: DOS Batch Forum
- Topic: set /p choice /t prompt? correct format
- Replies: 4
- Views: 5400
Re: set /p choice /t prompt? correct format
Thank you, that was simple enough.
Is there a way to use the Set /p so I can test Y or N instead of errorlevel?
Is there a way to use the Set /p so I can test Y or N instead of errorlevel?
- 01 Feb 2015 15:37
- Forum: DOS Batch Forum
- Topic: Browse folder names only no path and put in text file
- Replies: 4
- Views: 4757
Re: Browse folder names only no path and put in text file
Thanks but that just posted "Exclude folder [%%~nxA]
- 01 Feb 2015 14:48
- Forum: DOS Batch Forum
- Topic: Browse folder names only no path and put in text file
- Replies: 4
- Views: 4757
Browse folder names only no path and put in text file
I have a utility using xcopy excludes some folder or files. The plan is to display each folder and ask if you would like to exclude it from the backup. This is as far as I could get; for %%f in ("%userprofile%\Documents\*") do ( choice /c yn /m "Exclude Folder [%%~dpnxf]? " if er...
- 01 Feb 2015 14:38
- Forum: DOS Batch Forum
- Topic: set /p choice /t prompt? correct format
- Replies: 4
- Views: 5400
set /p choice /t prompt? correct format
I haven't found a good choice example on the web. I had to format it like this. Can anyone get the message in line with the choice option; echo Would you like to set folders to exclude? CHOICE /T 4 /C ync /CS /D n if errorlevel=3 goto variables if errorlevel=2 goto backup if errorlevel=1 goto exclud...
- 10 Nov 2014 19:18
- Forum: DOS Batch Forum
- Topic: Find OS
- Replies: 6
- Views: 9766
Re: Find OS
Aacini, is there a way to just save the Version number so I can just go to version @echo off setlocal EnableDelayedExpansion ::Identify OS for /F "delims=" %%a in ('ver') do set ver=%%a set Version= for %%a in (95=95 98=98 ME=ME NT=NT 2000=2000 5.1.=XP 5.2.=2003 6.0.=Vista 6.1.=7 6.2.=8 6....
- 10 Aug 2012 11:17
- Forum: DOS Batch Forum
- Topic: Stopping services, restarting services(safemode)
- Replies: 17
- Views: 17533
Re: Stopping services, restarting services(safemode)
Liviu, That seem to work well. I put some pauses in it so I can see it as it works. Is there a way to >> push the disabled ones into a text file, then start disabled.txt I want to stop those currently running, and disable them from restarting. Of course I will need to list AV services as to not disa...
- 07 Aug 2012 11:12
- Forum: DOS Batch Forum
- Topic: Stopping services, restarting services(safemode)
- Replies: 17
- Views: 17533
Re: Stopping services, restarting services(safemode)
Didn't mean to sound like your not welcome to discuss the code, but fawers was on target with the code. Just needs some tweaking. I'm not discussing the practicallity of what I'm doing. It works great for me, and have had great sucess in all our satellite offices. Just automating what I am doing now...