gpt-4-1106-preview· OpenAI
WildChat-4.8M (AI2)
write powershell scritp which copies a n exe file from network share and starts it in…
- User
write powershell scritp which copies a n exe file from network share and starts it in hidden mode not showing any windows
- Assistant
The following PowerShell script will copy an EXE file from a network share to a local folder, then execute the file in hidden mode without showing any window:
powershell# Define the path for the network share and the local destination $networkSharePath = "\\YourNetworkShare\path\to\the\file.exe" $localDestinationPath = "C:\LocalPath\file.exe" # Copy the file from the network share to the local destination Copy-Item -Path $networkSharePath -Destination $localDestinationPath # Start the EXE in hidden mode $process = Start-Process -FilePath $localDestinationPath -WindowStyle Hidden -PassThru # Optional: Wait for the process to exit if needed # $process.WaitForExit() # Note: Including -PassThru allows you to get process information and control the process