Windows 10: Batch file not working

Discus and support Batch file not working in Windows 10 Network and Sharing to solve the problem; Hello, Iam making autorun project that if I plug Flash disc in my pc it autoruns batch file with my "assistant" what says Hi, what do you want? But... Discussion in 'Windows 10 Network and Sharing' started by Plawro, Oct 14, 2020.

  1. Plawro Win User

    Batch file not working


    Hello, Iam making autorun project that if I plug Flash disc in my pc it autoruns batch file with my "assistant" what says Hi, what do you want?

    But here are things that just doesn´t work:


    1.If I plug in the Flash disc autorun.inf dont do anything.

    2.If I manage batch file to create .txt file and write something in it it dont create anything maybe I need some permissions???


    Thank you for answering me, Plawro


    Code: the one what doesn´t work


    @Echo off

    set YYYYMMDD=%4%%DATE:~4,2%%DATE:~7,2%

    set /a time=%time%

    set /a rand=%random%

    set /a date=%date%

    if exist output.txt goto a

    if not exist output.txt goto b

    :a

    copy output.txt F:\Locker\SIC by Plawro\outputs\output%date%_%time%_%rand%.txt >nul

    ping localhost -n 1 >nul

    call outputreinstall.bat

    goto end



    :b

    call outputreinstall.bat

    goto end



    :end

    exit









    ::END OF YOUR CODE::



    echo.

    echo...Script Complete....

    echo.



    pause

    :)
     
    Plawro, Oct 14, 2020
    #1
  2. oily_17 Win User

    Batch Files Knowledge Base

    Don't use batch files very much but one I find useful is for creating a list of files in a directory.
    Just copy the text below into Notepad and save as Filelist.bat

    dir /a /-p /o:gen >filelist.txt

    When you run it from a folder it will create a Filelist.txt file,in the same folder, that lists all the files in that folder.Useful when you are too lazy to type all the files out yourself.
     
    oily_17, Oct 14, 2020
    #2
  3. Batch Files Knowledge Base

    Very nice and usefull thanks for contributing.
     
    AphexDreamer, Oct 14, 2020
    #3
  4. Steevo Win User

    Batch file not working

    Batch file to ping network

    No, batch files are extremely easy.

    A "If" requires three extra steps.

    Code is not how much you can put in, but how lite can you make it and still perform the functions.

    So

    @ echo off


    ping 1.4.1.4 >a.txt

    findstr /m "Request timed out" a.txt
    if %errorlevel%%==0 (
    echo Save our nets!!!
    )

    pause
     
    Steevo, Oct 14, 2020
    #4
Thema:

Batch file not working

Loading...
  1. Batch file not working - Similar Threads - Batch file working

  2. batch file is not working

    in Windows 10 Network and Sharing
    batch file is not working: Hi world,I need to get an absolute path value like this but it's not working well.batch file:==================================for /F "tokens=1" %%i in 'PowerShell -Command "& {Get-ChildItem %USERPROFILE%\Desktop\privacy\*.xlsx select -exp Name -last 1}"' do set FNAME=%%i...
  3. Batch File

    in Windows 10 Software and Apps
    Batch File: Hi, I am trying to create a batch file to determine whether a user account is signed on.I don't have enough experience to get it to @Echo it worked. Any advice please.Batch file:REM Query whether user SBackup is active@echo onsetlocal enabledelayedexpansionset...
  4. Batch Files

    in Windows 10 Gaming
    Batch Files: How do i make it that my batch file puts itself in to startup https://answers.microsoft.com/en-us/windows/forum/all/batch-files/6156404d-20d4-4f58-bee5-14629dbf7b10
  5. Batch Files

    in Windows 10 Software and Apps
    Batch Files: How do i make it that my batch file puts itself in to startup https://answers.microsoft.com/en-us/windows/forum/all/batch-files/6156404d-20d4-4f58-bee5-14629dbf7b10
  6. Allow batch file renamer to work?

    in Windows 10 Network and Sharing
    Allow batch file renamer to work?: I'm trying to use a batch file renamer in order to add terms to the beginning of a file:picture1.jpgpicture2.jpgadd "2022 - " to the beginning to give:2022 - picture1.jpg2022 - picture2.jpgFirst off, I'd like a suggestion as to a safe one to use. Free is obviously preferable,...
  7. Allow batch file renamer to work?

    in Windows 10 Gaming
    Allow batch file renamer to work?: I'm trying to use a batch file renamer in order to add terms to the beginning of a file:picture1.jpgpicture2.jpgadd "2022 - " to the beginning to give:2022 - picture1.jpg2022 - picture2.jpgFirst off, I'd like a suggestion as to a safe one to use. Free is obviously preferable,...
  8. Allow batch file renamer to work?

    in Windows 10 Software and Apps
    Allow batch file renamer to work?: I'm trying to use a batch file renamer in order to add terms to the beginning of a file:picture1.jpgpicture2.jpgadd "2022 - " to the beginning to give:2022 - picture1.jpg2022 - picture2.jpgFirst off, I'd like a suggestion as to a safe one to use. Free is obviously preferable,...
  9. Create batch files with Batch?

    in Windows 10 Software and Apps
    Create batch files with Batch?: How to create Batch and VBS files with Batch? So I write a batch file which I then convert to exe that creates new folders in a certain directory and then creates batch and VBS files with a certain content and saves them in the created folder. So it's similar to a program...
  10. Batch File

    in Windows 10 Support
    Batch File: I need a batch file to create a folder with sub folders. The sub folders will be named the current date, they will go in a folder on c drive. For example we can call the folder test and it would be in documents on c drive. Every time we run the batch file it would create a...