-1

I am attempting to make my USB somewhat like a "plug-and-go" device. I am putting scripts I need ran onto my USB, and making it so I only have to click a button or two for all the scripts to begin. I was wondering what commands I would use to do the following;

1) Whenever I plug in the USB, I would like to either hold or press a key (such as 1,2,3,4,etc) that would choose which script I ran. Is this possible?

2) Is it possible for me to plug in a USB, and with the correct scripts, not have to unplug the USB and have it run through a series of scripts (through start-ups/restarts) A better Explanation Is it possible that I run one script, which would require a restart, for my to keep the USB in, and as soon as the computer starts again it would run the next script specified.

Sorry if I am unclear. If you are willing to help, I am willing to explain it in a way you can understand.

Thanks!

HK4
  • 1

2 Answers2

0

You may be able to achieve something similar by using the Task scheduler in Windows (assuming your in a windows environment). As far as auto running scripts from flash drives its a bad idea, the majority of Antivirus software will block autorun scripts on a flash drive.

  • Yes, I am primarily using Windows 7. But thnak you for the heads up on the Anti-Virus. – HK4 Jun 13 '14 at 13:54
0

Lovely, I wanted to do this and I did. I used Command Prompt, batch language, I think, to do that.

I used this method:

  1. record that the USB had run the first script automatically
  2. restart the computer
  3. login and the autorun would pop up, logically
  4. it would run the second script because, from the record, the program knows to run another since the first had finished already
@echo off
title autorun
color 0a
mode con: cols=82 lines=25
set /p ran=<"check.txt"
if "%ran%" == "true" (goto second) else (goto first)

:first
echo Merry Easter~ (^u^) 
timeout /nobreak /t 3 >nul
echo true>"check.txt"
shutdown -r -t 0
pause >nul
echo Shutdown doesn't seems to be successful, but if you want, press any key to see the next message~
pause >nul
goto second

:second
echo Happy Christmas~ [>u<] 
timeout /nobreak /t 3 >nul
del "check.txt"
exit
Community
  • 1
  • 1
  • autorun is generally disabled by default on any current Windows version (and for a good reason) – Stephan Mar 20 '18 at 14:06
  • How can I turn it back on? I really wanted to use autorun but except in my school's Windows XP, nowhere seems to be okay for autorun, even my home's computer... –  Mar 25 '18 at 06:00
  • I tried it through settings but only CD was okay for autorun... I wrote the "autorun.inf" but was still not working... –  Mar 25 '18 at 06:46