using autoexec.bat files
Results 1 to 6 of 6

Thread: using autoexec.bat files

  1. #1
    Banned
    Join Date
    May 2005
    Posts
    12

    using autoexec.bat files

    I have a pen drive with some songs/doc/misc stuff on it and I have to use it to swap information from 2 different computers in my room. I was wondering if i could simply write an autoexec.bat file that when I plug the pen drive in, it automatically copies certain files to a specific location. Say the desktop for instance.

    I have very limited experience in batch writing, so if anyone can help me out i would appreciate it a ton.

    Thanks
    -Any

  2. #2
    Old ancient one vanman's Avatar
    Join Date
    Jul 2002
    Location
    Freestate,South Africa
    Posts
    570
    What o/s do you have?..Drag and drop it or copy and paste in any windows o/s.I mean if you have to put the (pen drive)?..I take it that this is a flashdrive..You have to insert that anyway so I don,t think it is a lot of effort to copy and paste anyway.It auto mounts in xp or install software on 98 etc..

    Do you have a specific reason for wanting to do that??
    Practise what you preach.

  3. #3
    In And Above Man Black Cluster's Avatar
    Join Date
    Feb 2005
    Posts
    912
    Another lazy boy is here ....

    The following link contains the commands you will need to perform the task you asked about .... this link will cut the corners and make it easier to write the sought file .... remember .... you have to practice in order to attain a clear and bebficial experience in the industry ....

    http://labmice.techtarget.com/articles/batchcmds.htm

    cheers
    \"The only truly secure system is one that is powered off, cast in a block of concrete and sealed in a lead-lined room with armed guards - and even then I have my doubts\".....Spaf
    Everytime I learn a new thing, I discover how ignorant I am.- ... Black Cluster

  4. #4
    Senior Member
    Join Date
    Mar 2004
    Posts
    557
    Hi

    A little comment: I propose part of a solution here, which I
    find very convenient. I use the AutoRun[1] functionality. I
    assume you are using Windows XP (SP2)or similar. You can
    enable it (if not by default) by using a little registry tweak[2].


    AutoPlay and Drive's context menu

    My USB-sticks are creating entries in the context menu of the
    drive (check using "My Computer"-environment). Each stick has
    a Autorun.inf-file in the root directory, containing something like

    Code:
    [autorun]
    action=Run AutoStart.Exe
    icon=wireless.ico
    label=Wireless Tools
    open=autostart.exe
    shell=search
    shell\search=&Search
    shell\search\command=search.exe
    shell\enum=&Enum
    shell\enum\command=enum.bat
    Explanation

    action, icon, label and open is a default set for AutoPlay.
    Action creates an entry "Run AutoStart.Exe" in the AutoPlay menu,
    an icon and label is assigned to the drive's properties and
    with "open" a command is provided, here AutoStart.Exe will
    be executed.


    One can also control the double- or right-click on the drive's symbol
    (again: check via "My computer"-environment).
    Code:
    shell=search
    will provide the default "command" performed by a double-click.
    shell\search defines such a command:
    Code:
    shell\search=&Search
    will create the context-menu entry "Search". The context-menu is
    activated using the right-click. By clicking on the context-menu entry
    Code:
    shell\search\command=search.exe
    will be executed . You also can execute batch-files - write one to copy
    the files onto or from the Desktop[3] (...) .

    I provided this kind of information, because the AutoRun/Play
    capabilities might come in handy for some of you - note, it
    should be in the responsibility of an administrator in schools,
    libraries or publicly available computers to disable USB drives
    and other removable medias, as far as possible.

    Cheers.


    [1] http://msdn.microsoft.com/library/de...oplay_cmds.asp
    [2] http://autorun.moonvalley.com/enable.htm
    [3] http://www.antionline.com/showthread...hreadid=268186
    If the only tool you have is a hammer, you tend to see every problem as a nail.
    (Abraham Maslow, Psychologist, 1908-70)

  5. #5
    Banned
    Join Date
    Jun 2004
    Posts
    154
    this was pretty helpful, im glad i stopped by to read it. well done

  6. #6
    Banned
    Join Date
    Nov 2003
    Posts
    1,161

    Re: using autoexec.bat files

    Originally posted here by Any
    I have a pen drive with some songs/doc/misc stuff on it and I have to use it to swap information from 2 different computers in my room. I was wondering if i could simply write an autoexec.bat file that when I plug the pen drive in, it automatically copies certain files to a specific location. Say the desktop for instance.

    I have very limited experience in batch writing, so if anyone can help me out i would appreciate it a ton.

    Thanks
    -Any
    I tell you what, since I don't know your specific directories, I'll show you a place where someone will write one up for you. http://www.windowsshellscripting.com/ Navigate from here to "Question & Answer Board" *****Enlist the help of Forum Moderator ElvisIncognito & docrice. ***Tell them pbarrette sent you.
    The book on the front page is called Windows NT Shell Scripting by Timothy Hill. That book is like the bible for this stuff. It will make configuring NT a lot easier and quicker. I own it and I've scanned the autoexec.bat page for you. Attached below.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •