Hi all, I need a .cmd or .bat file so that when I run it will automatically disconnect internet in 30 seconds and then it re-connects internet again. Would you please help me with the command lines. Thanks so much in advance.
ECHO ON netsh interface set interface name="Local Area Connection" admin=DISABLED TIMEOUT 30 netsh.exe interface set interface name="Local Area Connection" admin=ENABLED would have to be run as Administrator.. and "local Area Connection" changed as necessary
This command is for Local Area Connection only. Can you show me the command lines for both Local Area Connection and Wireless. I mean that When I run this command ..... It will automatically disconnect Local Area Connection or Wireless if one of 2 appears. Thanks a lot in advance
netsh interface set interface name="wi-fi" admin=disable replace wifi with what ever your wireless connection name is which you can find out with: netsh wlan show interface It will be, mine for example: Name : Wi-Fi which is where I got Wi-Fi in: netsh interface set interface name="wi-fi" admin=disable
@Humphrey Thanks for your reply. I'm a little confused that one of mine is WI-FI and other is WI-FI 3. Therefore I must replace interface name as I run. I wonder whether or not we can use a command to disable or enable no matter what it is Wireless or Local Area Connection. like Josh Cell " Advanced Tokens Manager - The Activation Backup Solution " Do you have any ideas ? Thanks for your concern.
You will have to have a line for each one. Disable_Enable_w.Lan.bat Code: @ECHO OFF netsh interface set interface name="wi-fi" admin=disable netsh interface set interface name="wi-fi 3" admin=disable netsh interface set interface name="Local Area Connection" admin=DISABLED TIMEOUT 30 netsh interface set interface name="wi-fi" admin=ENABLED netsh interface set interface name="wi-fi 3" admin=ENABLED netsh interface set interface name="Local Area Connection" admin=ENABLED EXIT Run as admin.
I have a cmd file that I wrote to backup partitions, to an external hard drive, using Macrium Reflect. The problem I have is that I don't always get the same drive letter when I attach the drive and the script fails. Is there some way to find the drive letter within the script, that is assigned to my external hard drive labelled "Toshiba", so that my script can handle any drive letter assigned?
You can search for a specific file on the drive to determine, like in the example: Code: for %%d in (c d e f g h i j k l m n o p q r s t u v w x y z) do ( if exist %%d:\sources\install.wim ( set path2=%%d: ) )
I would create a text file like 'Toshiba.txt' in root folder of the drive and then use (a slightly shortened form ): Code: for %%d in (c d e f g h i j k l m n o p q r s t u v w x y z) do ( if exist %%d:\Backups set path=%%d: ) Yep, should work . See the shortened form above .
couldn't you just change the drive letter of external to "Z" , then when you plug it in , it will always assign the letter "Z"
Code: for /f %%D in ('wmic volume get DriveLetter^, Label ^| find "Toshiba"') do set usb=%%D This will select drive by volume name..
No problem, as long as someone finds such nice solution. Most probably anybody already invented the wheel, problem is mostly to find it ....
Try This: Code: @For /f "UseBackQ Tokens=1* Delims==" %%a In ( `Wmic LogicalDisk Where "VolumeName='TOSHIBA'" Get DeviceID /Value` ) Do @(If '%%b Neq ' Call :StartMe %%b) @GoTo :Eof :StartMe @Echo Off SetLocal Set USB=%1 Now that the DriveLetter is defined as %USB% just put the rest of your script content at the bottom.