1.

Solve : How to Control USB POrt (on/off) using batch file??

Answer»
The BATCH file uses some fundamental MS-DOS batch file commands.

The "rem" command is used in this instance to document the following procedure.

The "Net Share" command displays the current status of any active "share(s)".

The "@echo on" switches on the display of the "Net Share" command and when the command is completed the "@echo off" command switches the display of any further following command to "off" until such time as may be another "@echo on" command is executed.

I do hope that I have answered your question once again.

At this rate before I know it I will be a "Guru" on this site by just answering all your questions.

But echo off / on merely suppresses the echoing of internal commands. You really don't understand batch, do you? All that your @echo on does is force a prompt to be displayed. And you still haven't answered the question. Because you can't, maybe?

v1.bat

Code: [Select]@echo off
@echo Now running net share
@echo.
@echo on
net share
@echo off
v2.bat
Code: [Select]@echo off
echo Now running net share
echo.
net share

The results...

Code: [Select]S:\>v1.bat
Now running net share


S:\>net share

Share name Resource Remark

-------------------------------------------------------------------------------
IPC$ Remote IPC
The command completed successfully.
Code: [Select]S:\>v2.bat
Now running net share


Share name Resource Remark

-------------------------------------------------------------------------------
IPC$ Remote IPC
The command completed successfully.



@echo off
break on
@echo.
@echo.
@echo.
@echo This has just become a futile discussion with your added sarcasms.
@echo.
@echo Therefore I am being mature about this and ending it here and now!
@echo.
@echo.
pause
exit

Poor Steve. He was just TRYING to help.

His code was long with a lot of extra statements and not very efficient, but I didn't see any obvious logic or syntax ERRORS. Looking at his code, I just assumed he worked for the government.@echo off
echo Dias is right.
echo.
pause>nul
exit.Quote from: Biker Steve on FEBRUARY 18, 2009, 04:03:21 PM



@echo off
break on


@echo.
@echo.
@echo.
@echo This has just become a futile discussion with your added sarcasms.
@echo.
@echo Therefore I am being mature about this and ending it here and now!
@echo.
@echo.
pause
exit



why the "BREAK"?

according to the output from "help break"

Quote
This is present for Compatibility with DOS systems. It has no effect
under Windows XP
.

If Command EXTENSIONS are enabled, and running on the Windows XP
platform, then the BREAK command will enter a hard coded breakpoint
if being debugged by a debugger.

And even with a DOS targeted batch the "Break" command at least as far as I know is only a Config.sys command.

LOL I just had to keep the prodding up
When under taking the MS DOS "Help Break" command you have failed to mention that the command also displays the line "Sets or Clears Extended Ctrl+C checking on DOS systems".

In simple terms what this means is that when executing this fundamental "Break On" command from within a MS-DOS batch file a user can terminate the operation of the MS-DOS file prematurely by pressing both the "Ctrl and C" keyboard keys together. You will then be asked "Terminate batch job (Y/N)".


lets just say to the OP, get MS's Devcon.....

end of story....bye bye...see you later Quote from: Biker Steve on February 20, 2009, 06:18:08 PM

When under taking the MS DOS "Help Break" command you have failed to mention that the command also displays the line "Sets or Clears Extended Ctrl+C checking on DOS systems".

In simple terms what this means is that when executing this fundamental "Break On" command from within a MS-DOS batch file a user can terminate the operation of the MS-DOS file prematurely by pressing both the "Ctrl and C" keyboard keys together. You will then be asked "Terminate batch job (Y/N)".





True, but considering there is no MOUNTVOL or a few other commands used in that batch, it's a bit silly to add something that only works on Pure DOS.


Discussion

No Comment Found