Windows 10: BATCH - Run as Admin from current path instead system32 folder.......

Discus and support BATCH - Run as Admin from current path instead system32 folder....... in Windows 10 Support to solve the problem; For order a my folder i have created a similar .bat files: Code: md A md B ... ... md Z move a*.* .\A move b*.* .\B .. .. move z*.* .\Z There's a big... Discussion in 'Windows 10 Support' started by DjDiabolik, Nov 10, 2020.

  1. BATCH - Run as Admin from current path instead system32 folder.......


    For order a my folder i have created a similar .bat files:
    Code:
    There's a big issue......... i need to run this batch as admin and i have used the command "Run as Admin" from context menu and i hope i don't have create a BIG ISSUE on my windows 10 installation.
    Because this BATCH it's not corrently been executed from the path how it's stored the batch but all commands it's be correctly runned from C:\WINDOWS\SYSTEM32 folder!!!

    I don't have idea because there's append but right now on C:\Windows\System32 i have all subforder called A B C etc whit all files MOVED inside!!
    Some files it's not be moved because i see from windows prompt it's say it's protect (and problably all files it's currently used by windows 10).

    I have right now move back all files from all subfolder and i hope i need to reformat my windows or obtain boot problems at next reboot of my pc.... instead this because there's append !?!?

    How i can fix this issue ? Because if i use RUN AS ADMIN for a batch files the bat it's runned from system32 folder and not from the corrent path how it's stored the bat files ??

    :)
     
    DjDiabolik, Nov 10, 2020
    #1
  2. fahnix Win User

    Batch files fail pathing and [%04d]

    1 When running in Administrator mode batch files automatically take on the Windows\System32 folder unless a prefix is added to the top of the file.

    command example: copy file1.txt "C:\Users\Public\Test\."

    result copies file in current folder to "C:\Users\Public\Test\file1.txt"

    result from batch file as admin is an error stating "File not found" because Admin mode attempts to call commands listed in file from [Windows\System32] folder.

    include [cd %~dp0] at top of batch file to ensure commands run from the folder the batch file resides in.

    2 When running ffmpeg.exe in one folder and writing files to another folder from a batch file Windows automatically pastes the entire path and the batch file name prior to every attempted file write.

    ffmpeg command example :

    bin\ffmpeg.exe -i "C:\Users\JoeMatize\Videos\Logitech Webcam\video 3.wmv" -r 15 "frames-%04d.bmp"

    then windows creates 15 frames per second naming files [frames-0001.bmp] through [frames-0015.bmp] for the 1st second and continuing through the entire file

    But ffmCmd.bat file contains the command attempts to create the output file as...

    "C:\_dev\_Video\FFMPeg_Zeranoe\ffmpeg-20160517-git-af3e944-win64-static\ffmCmd.bat4d.bmp"

    ffmpeg fails when it is unable to acquire a new name for the sequential files.

    is there another command that will fix the batch call to ffmpeg, like the one that fixes the administrative mode path?

    When will Microsoft fix the batch files so they work consistently across the board?
     
    fahnix, Nov 10, 2020
    #2
  3. Bree Win User
    running DOS as ADMIN

    I suggested that in post #4 but @bromberg doesn't seem to have tried it yet...
     
  4. djmcnz Win User

    BATCH - Run as Admin from current path instead system32 folder.......

    running DOS as ADMIN

    I assume you don't have 'exit' anywhere in your batch file?

    Rather than playing with 'pause' - if you want to see the output...

    1. Open a command window as admin
    2. Run the batch file manually
    3. Command window will not close unless the 'exit' command is issued
    4. Read output
    That's the first step I'd take to diagnose. Then run every line in your batch file manually, one-by-one, in your admin command window (copy and paste from the actual batch file, don't retype the commands).

    You'll soon find your problem.
     
    djmcnz, Nov 10, 2020
    #4
Thema:

BATCH - Run as Admin from current path instead system32 folder.......

Loading...
  1. BATCH - Run as Admin from current path instead system32 folder....... - Similar Threads - BATCH Run Admin

  2. Trouble with batch files and paths

    in Windows 10 Support
    Trouble with batch files and paths: Running win 10 v 1909 build 18363.720. I am pretty green with batch files and paths. I am trying to automate and editing process with mkvpropedit on a bunch of MKV files. I put the bat file in the same folder as the mkvs. Batch file contains: @echo off for %%a in (*.mkv)...
  3. Copying exe into system32 folder no longer allows me to run that exe without typing path...

    in Windows 10 Customization
    Copying exe into system32 folder no longer allows me to run that exe without typing path...: In the past, If I wanted to run a program like "procexp.exe" from the RUN box without having to type the entire folder path to the executable, I would first copy the exe into "c:\windows\system32" folder. This no longer works for me. Am I right? Did an update disable...
  4. How to run a batch file in admin mode from a user account?

    in Windows 10 Support
    How to run a batch file in admin mode from a user account?: I've created batch files to run the following commands to work around a particular problem: sc stop cldflt sc start cldflt The batch files work in my user account if you right click and run them as Administrator. There are methods on the forum to run these batch files from...
  5. Run the audio troubleshooter from a batch script

    in Windows 10 Drivers and Hardware
    Run the audio troubleshooter from a batch script: I have an automated home theatre setup - a batch script that enables my TV as a display, and changes the TV to be my primary display (so games and apps open on my TV instead of my monitor). The same script also changes my default audio device to be the TV. The problem is...
  6. Batch file to current date and time

    in Windows 10 Customization
    Batch file to current date and time: Dear expert. Can you help me to batch file to change system date and time to current? Best regards, https://answers.microsoft.com/en-us/windows/forum/all/batch-file-to-current-date-and-time/2c75b187-3561-4604-b9b5-218db993a6f6
  7. Run oscdimg.exe from a batch file?

    in Windows 10 Installation and Upgrade
    Run oscdimg.exe from a batch file?: OK, I have a batch file that copies files from a mounted windows 10 installation file and updates drivers in boot.wim and install.wim. The thing I cannot work out is how to automatically run oscdimg.exe (command from deployment and imaging environment) in a batch file so I...
  8. Batch files won't run, open editor instead

    in Windows 10 Software and Apps
    Batch files won't run, open editor instead: Somehow (most likely my fault) .bat files have defaulted to opening my text editor (UltraEdit) instead of executing. I took all the file associations out of UltraEdit and re-started - no change I followed internet advice to remove...
  9. how to run process explorer from startup folder as admin

    in Windows 10 Software and Apps
    how to run process explorer from startup folder as admin: There are several items that don't appear in process explorer (sysinternals) unless it is run as administrator. I want to do this everytime I log in, so I placed a shortcut in the startup folder. This only works if I don't change the compatibility settings on it to run as...
  10. Opening screenshot from Action Center opens System32 folder instead.

    in Windows 10 Support
    Opening screenshot from Action Center opens System32 folder instead.: As the title says this has happened twice in the last week. I would take a screenshots with the prt sc key, and if I try to open it from the Action Center, System32 opens instead of the Screenshots folder in OneDrive. It only happened twice so far (out of maybe 15...