小编ran*_*err的帖子

如何使用批处理文件为Everyone组授予文件夹权限

我试图添加组Everyone并赋予它modify文件夹的权限.我正在使用批处理文件来试试这个.所以对于我有icacls "C:\Program Files (x86)\Program File" /grant:r Everyone:M 但是当我去看看文件夹的权限时,没有任何改变.

permissions file-permissions batch-file icacls

10
推荐指数
1
解决办法
5万
查看次数

将变量从批处理传递到 powershell

我有一个批处理文件,要求用户输入变量 line set /p asset=。我像这样调用我的 powershell 脚本

SET ThisScriptsDirectory=%~dp0

SET PowerShellScriptPath=%ThisScriptsDirectory%file.ps

PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%PowerShellScriptPath%'";

我想知道如何从我的批处理文件中向 powershell 发送变量“资产”。

这是我的 .bat 文件内容

@Echo off  
cls
Color E
cls

@echo Enter asset below
set /p asset=

@echo.
@echo your asset is %asset%
@echo.
goto startusmt

:startusmt
@echo.
@echo executing psexec ...
@echo.

SET ThisScriptsDirectory=%~dp0
SET PowerShellScriptPath=%ThisScriptsDirectory%RemoteUSMT.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -file %PowerShellScriptPath% %asset%
psexec \\%asset% -u domain\username -p password cmd 

goto EOF

:EOF 
PAUSE
Run Code Online (Sandbox Code Playgroud)

powershell batch-file

2
推荐指数
2
解决办法
1万
查看次数