admin管理员组

文章数量:1201787

I'm trying to run a gradle project using a batch file on startup.

The bat file has 2 commands:

cd C:\Users\...(Project location)
gradlew run -i 2>&1 1>lastRunLogs.txt

The bat file worked fine until recently, and now for some reason it just hangs after the cd command finishes.

If I go to the project location, and trigger a copy of the exact same bat file there, it works perfectly, so I don't think the file is at fault here.

At this point, I'm not sure if its a Windows 11 update that broke this, or if there's some command changes that I need to make to make this work again.

Anyone got any pointers?

Windows version: Windows 11 24H2

Note 1: I don't have Admin privileges on this device, so I can't try out anything requiring that.

Note 2: The last part in the second command is because I want to store the logs in case something goes wrong, since gradle executions via bat files seem to ignore the pause command... Anyone know about a fix for this btw?

Adding results of the commands Mofi suggested

C:\Users\<my_user_here>>where gradlew
INFO: Could not find files for the given pattern(s).

C:\Users\<my_user_here>>set path
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Users\<my_user_here>\AppData\Local\Microsoft\WindowsApps;;C:\Users\<my_user_here>\AppData\Local\JetBrains\IntelliJ IDEA Community Edition 2024.2.3\bin;C:\Users\<my_user_here>\.jdks\corretto-19.0.2\bin;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

C:\Users\<my_user_here>>reg query HKCU\Environment /v Path

HKEY_CURRENT_USER\Environment
    Path    REG_SZ    C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Users\<my_user_here>\AppData\Local\Microsoft\WindowsApps;;C:\Users\<my_user_here>\AppData\Local\JetBrains\IntelliJ IDEA Community Edition 2024.2.3\bin;C:\Users\<my_user_here>\.jdks\corretto-19.0.2\bin;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps


C:\Users\<my_user_here>>reg query "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" /v Path

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment
    Path    REG_EXPAND_SZ    %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%SYSTEMROOT%\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd


C:\Users\<my_user_here>>reg query "HKCU\Software\Microsoft\Command Processor" /v AutoRun
ERROR: The system was unable to find the specified registry key or value.

C:\Users\<my_user_here>>reg query "HKLM\Software\Microsoft\Command Processor" /v AutoRun


ERROR: The system was unable to find the specified registry key or value.

本文标签: windowsbat file stuck on command if run on startupStack Overflow