Results 1 to 5 of 5

Thread: Batch/Script Program Help

  1. #1
    Join Date
    Sep 2009
    Location
    New Jersey
    Beans
    272
    Distro
    Ubuntu 10.04 Lucid Lynx

    Batch/Script Program Help

    Hello everyone! I am writing a batch (or as I was informed a "script") file that takes the input from the user and writes a text document in a specific folder for a specific employee. Every time the program attempts to make the text document it says, "Cannot find designated folder." Here is the code:

    Code:
    @echo off
    title Hour Recorder
    cd DESKTOP LOCATION
    ping localhost -n 2 >nul 
    ping localhost -n 2 >nul
    ping localhost -n 2 >nul
    cls
    echo Do you need to create a new folder for a new employee?  
    set Choice1=
    set /p Choice1=(y/n):
    if %Choice1% == y goto NewFolder
    if %Choice1% == n goto NoNewFolder
    :NewFolder
    set Choice2=
    set /p Choice2=Name: (One word.  I.E. RandomName.  Or, if you are saving something in a already made folder, type in the name again.  There will be an error; ignore it.):
    cd DESKTOP FOLDER LOCATION
    md %Choice2%
    ping localhost -n 2 >nul
    echo Created!
    pause
    cls
    :NoNewFolder
    echo Now we are working on adding the information into a text document!
    set Date=
    set /p Date=Date:
    set JobSite1=
    set /p Location1=Location:
    set Hours1=
    set /p Hours1=Hours:
    pause
    echo Creating File!
    cd DESKTOP FOLDER LOCATION/%Choice2%
    echo <li>Date: %Date% <li>Job Site: %Location1% <li>Hours: %Hours1% >> %Choice3%.txt
    pause
    Also, is there a way that I can make it so you don't have to re-enter the name and it will just make the text document go where it needs to go?

    **NOTE**
    The "DESKTOP LOCATION" is the actual location of the desktop (i.e. C:\Users\(Name)\Desktop\...
    Last edited by Hosmion; May 31st, 2010 at 05:16 PM.

  2. #2
    Join Date
    Jun 2006
    Beans
    2,930

    Re: Batch/Script Program Help

    This is for windows, correct?
    Support 7z in default installs!!!: Click Here

    How to use code blocks to post command output: Click Here
    Official Ubuntu Documentation

  3. #3
    Join Date
    Sep 2009
    Location
    New Jersey
    Beans
    272
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Batch/Script Program Help

    Yes, this is for Windows.

  4. #4
    Join Date
    Jul 2006
    Beans
    80
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Batch/Script Program Help

    Hi everyone, could somebody please explain to me how to defrag a hard drive, create a system restore, rename my C: drive to D: drive, and install anti-virus software?

  5. #5
    Join Date
    Jun 2008
    Beans
    204
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Batch/Script Program Help


    **NOTE**
    The "DESKTOP LOCATION" is the actual location of the desktop (i.e. C:\Users\(Name)\Desktop\...
    Where are you running this from (e.g. an admin machine)? If you are on a network you will have to make sure you include the network name when you specify that in the DESKTOP LOCATION.

    e.g. you might have "WorkNetwork" as J: but will have to refer to it as WorkNetwork\...



    Just a guess - given the info above
    Hi everyone, could somebody please explain to me how to defrag a hard drive, create a system restore, rename my C: drive to D: drive, and install anti-virus software?
    In my limited experience, these forums usually offer the best/quickest advice on the web

Tags for this Thread

Bookmarks

Posting Permissions

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