Execution problem with .bat file
mathilde5635
Posted messages
2
Status
Membre
-
brucine Posted messages 24395 Registration date Status Membre Last intervention -
brucine Posted messages 24395 Registration date Status Membre Last intervention -
Hello,
I created a simple .bat file that runs a python file. It works on several computers but on one, we can’t get it to work.
A window opens with "File Open – Security Warning", after clicking on "Run", the Shell window opens with the message "CMD.EXE has been started with the path as the current directory. UNC paths are not supported. Using the default Windows directory. Access denied."

I don’t know how to get the .bat file to work, especially since I can’t "run as administrator"
Thank you
I created a simple .bat file that runs a python file. It works on several computers but on one, we can’t get it to work.
A window opens with "File Open – Security Warning", after clicking on "Run", the Shell window opens with the message "CMD.EXE has been started with the path as the current directory. UNC paths are not supported. Using the default Windows directory. Access denied."
I don’t know how to get the .bat file to work, especially since I can’t "run as administrator"
Thank you
2 réponses
Hello,
The issue seems to be with UAC, which cannot be disabled just through the control panel in the presence of a network drive; adjustments need to be made through the registry:
https://social.technet.microsoft.com/Forums/fr-FR/fd44ec61-f6f1-4f6e-8515-fc159822a6f7/ouverture-dun-bat-sur-un-lecteur-reseau?forum=windowsserver2008fr
The issue seems to be with UAC, which cannot be disabled just through the control panel in the presence of a network drive; adjustments need to be made through the registry:
https://social.technet.microsoft.com/Forums/fr-FR/fd44ec61-f6f1-4f6e-8515-fc159822a6f7/ouverture-dun-bat-sur-un-lecteur-reseau?forum=windowsserver2008fr
Thank you for your response :)
And I'm sorry, I didn't really understand, is it a question of rights?
How can I resolve the issue?
Is there no line of code to add to the batch file to solve the problem?
And I'm sorry, I didn't really understand, is it a question of rights?
How can I resolve the issue?
Is there no line of code to add to the batch file to solve the problem?
If the rights are not the issue as I illustrated earlier (but then we don't see why it would work on some machines and not others), it's that your command (we don't know which one) does not support UNC paths.
At least two ways to remedy this:
File and printer sharing must be enabled on the target PC (which may be the cause of our troubles), the target folder must be shared, and the "source" user must have the appropriate rights (identification, password) for reading and/or writing.
NET USE V: \\monpc\C$
Here, I create a virtual drive V: that represents the local PC named monpc and where I want to share the administrative share C$; I can specify a particular folder in this share.
I can specify the credentials in the command:
NET USE G: \\Server64\Share1 /USER:SS64dom\user64
but in that case, unless I go through PowerShell, a prompt will ask me for the password.
https://ss64.com/nt/net-use.html
PAIR OF COMMANDS PUSHD POPD
I must then chain the required commands to PUSHD by means of the & parameters, for example:
PUSHD "\\monpc\C$\mondossier\" &&(
forfiles -s -m *.* -d -7 -c "cmd /c del /q @path"
) & POPD
https://ss64.com/nt/pushd.html
At least two ways to remedy this:
File and printer sharing must be enabled on the target PC (which may be the cause of our troubles), the target folder must be shared, and the "source" user must have the appropriate rights (identification, password) for reading and/or writing.
NET USE V: \\monpc\C$
Here, I create a virtual drive V: that represents the local PC named monpc and where I want to share the administrative share C$; I can specify a particular folder in this share.
I can specify the credentials in the command:
NET USE G: \\Server64\Share1 /USER:SS64dom\user64
but in that case, unless I go through PowerShell, a prompt will ask me for the password.
https://ss64.com/nt/net-use.html
PAIR OF COMMANDS PUSHD POPD
I must then chain the required commands to PUSHD by means of the & parameters, for example:
PUSHD "\\monpc\C$\mondossier\" &&(
forfiles -s -m *.* -d -7 -c "cmd /c del /q @path"
) & POPD
https://ss64.com/nt/pushd.html