Jump to content
Sign in to follow this  
blumi

Run cmd file from network

Recommended Posts

blumi

Hi,

I have a few lines of code and have a question about them.

I want to run a cmd.file, the cmd file calls the powershell to do some things.

If I run the script from the desktop all works fine, remove.cmd starts the powershell and all is done.

If I run the script from the network, nothing happens.

Not sure it the problem is the @comspec or the powershell code

 

Maybe there is a better way to run the powershell commands with autoit, please let me know.

 

The autoit code

$script =  @DesktopDir & "\Remove.cmd"
 RunWait(@ComSpec & " /c " & $script)

Here the code from the cmd

setlocal enableextensions
cd /d "%~dp0"
cd
powershell -command Set-ExecutionPolicy RemoteSigned
powershell .\Remove.ps1

REM pause

And here the code from the powershell

Get-AppXProvisionedPackage -online | Remove-AppxProvisionedPackage –online

Get-AppXPackage | Remove-AppxPackage

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×