Windows 10: Batch File

Discus and support Batch File in Windows 10 Software and Apps to solve the problem; 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.... Discussion in 'Windows 10 Software and Apps' started by vRah, Oct 13, 2023.

  1. vRah Win User

    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 varuser=Noneecho %varuser%if query user SBackup /server:Inspiron-5515 == "SBackup" set varuser=SBackup if "%varuser% == "SBackup" @Echo it workedecho %varuser%pauseCommand window results:

    :)
     
  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 13, 2023
    #2
  3. Batch Files Knowledge Base

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

    Batch File

    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 13, 2023
    #4
Thema:

Batch File

Loading...
  1. Batch File - Similar Threads - Batch File

  2. Start program from batch file. Why does it open an "empty" window?

    in Windows 10 Gaming
    Start program from batch file. Why does it open an "empty" window?: Have a batch file that opens Microsoft Money with it's data file on H:/Money.Why does the batch file open the lower window when it executes?The batch file is pretty simple::@ECHO OFF "C:\Program Files x86\Microsoft Money Plus\MNYCoreFiles\MSMoney.exe" "H:Money\D&KWebb.mny"...
  3. Start program from batch file. Why does it open an "empty" window?

    in Windows 10 Software and Apps
    Start program from batch file. Why does it open an "empty" window?: Have a batch file that opens Microsoft Money with it's data file on H:/Money.Why does the batch file open the lower window when it executes?The batch file is pretty simple::@ECHO OFF "C:\Program Files x86\Microsoft Money Plus\MNYCoreFiles\MSMoney.exe" "H:Money\D&KWebb.mny"...
  4. Batch file help, please

    in Windows 10 Software and Apps
    Batch file help, please: Want to write a batch file that will start an executable program from it's data file location on another drive H:. Been a LONG time since I wrote a batch tile. Could I get some help?@ECHO OFFCD H:\DATAFILEPATHC:\PROGRAM FILES x86\EXECUTABLEFILEPATH\EXECUTABLE FILE...
  5. Batch file help, please

    in Windows 10 Gaming
    Batch file help, please: Want to write a batch file that will start an executable program from it's data file location on another drive H:. Been a LONG time since I wrote a batch tile. Could I get some help?@ECHO OFFCD H:\DATAFILEPATHC:\PROGRAM FILES x86\EXECUTABLEFILEPATH\EXECUTABLE FILE...
  6. renaming batch files

    in Windows 10 Network and Sharing
    renaming batch files: Hi,I have had to try and restore from windows file history but it adds a time stamp so my software cant locate the files due to the time stamp.so I have been using windows ppower shell to remove the date if its the same for each fileget-childitem *.png foreach { rename-item...
  7. renaming batch files

    in Windows 10 Gaming
    renaming batch files: Hi,I have had to try and restore from windows file history but it adds a time stamp so my software cant locate the files due to the time stamp.so I have been using windows ppower shell to remove the date if its the same for each fileget-childitem *.png foreach { rename-item...
  8. renaming batch files

    in Windows 10 Software and Apps
    renaming batch files: Hi,I have had to try and restore from windows file history but it adds a time stamp so my software cant locate the files due to the time stamp.so I have been using windows ppower shell to remove the date if its the same for each fileget-childitem *.png foreach { rename-item...
  9. How do you pin a batch file created in Notepad to the Start Menu?

    in Windows 10 Gaming
    How do you pin a batch file created in Notepad to the Start Menu?: How do you pin a batch file created in Notepad to the Start Menu? I have the batch file...whatever.bat. What do I do now? I didn't understand other instructions I saw before. Thanks....
  10. How do you pin a batch file created in Notepad to the Start Menu?

    in Windows 10 Software and Apps
    How do you pin a batch file created in Notepad to the Start Menu?: How do you pin a batch file created in Notepad to the Start Menu? I have the batch file...whatever.bat. What do I do now? I didn't understand other instructions I saw before. Thanks....