简体   繁体   中英

I have a command that will run in cmd but wont run as batch file

I have the below command. It runs if I run it from cmd even if I cd to any location first. How come it doesn't run if I save it as a batch file? The code checks a list of users and sees if they are disabled in AD. If any of them are it exports the list to deactivatedusers.txt. I am running the machine as admin.

for /f %a in (c:\test\users.txt) do net user %a /domain |findstr /C:"Account active               No" && echo %a is deactivated >>c:\test\deactivatedusers.txt
for /f %%a in (c:\test\users.txt) do net user %%a /domain |findstr /C:"Account active 

从批处理中执行命令时,需要将%翻倍。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM