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. Show full path in the 'Folder' column when searching, instead of folder name + path

    in Windows 10 Gaming
    Show full path in the 'Folder' column when searching, instead of folder name + path: In explorer, if I search for something, say "Fallout4*.ini" in my Steam library, my search results in Details view look like this:NameDate modifiedType SizeFolderFallout4_Default.ini13/10/2021 15:05Configuration settings3 KBFallout 4...
  3. Show full path in the 'Folder' column when searching, instead of folder name + path

    in Windows 10 Software and Apps
    Show full path in the 'Folder' column when searching, instead of folder name + path: In explorer, if I search for something, say "Fallout4*.ini" in my Steam library, my search results in Details view look like this:NameDate modifiedType SizeFolderFallout4_Default.ini13/10/2021 15:05Configuration settings3 KBFallout 4...
  4. Show full path in the 'Folder' column when searching, instead of folder name + path

    in Windows 10 Customization
    Show full path in the 'Folder' column when searching, instead of folder name + path: In explorer, if I search for something, say "Fallout4*.ini" in my Steam library, my search results in Details view look like this:NameDate modifiedType SizeFolderFallout4_Default.ini13/10/2021 15:05Configuration settings3 KBFallout 4...
  5. Folder opening the same folder instead of going in folder path.

    in Windows 10 Gaming
    Folder opening the same folder instead of going in folder path.: So recently i noticed everytime i go into a folder it will just open the same path that i'm currently in.Example when i double click on Desktop folder in File Explorer, it doesnt show me the files i have on desktop but instead it opens a duplicate folder.Anyone ever...
  6. Folder opening the same folder instead of going in folder path.

    in Windows 10 Software and Apps
    Folder opening the same folder instead of going in folder path.: So recently i noticed everytime i go into a folder it will just open the same path that i'm currently in.Example when i double click on Desktop folder in File Explorer, it doesnt show me the files i have on desktop but instead it opens a duplicate folder.Anyone ever...
  7. 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)...
  8. 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...
  9. 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...
  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...