Run PowerShell in Google Backup and Sync folder - powershell

I installed Google Backup and Sync and placed my PowerShell script, myscript.ps1, within the Google Backup and Sync folder at C:\Users\<username>\Google Drive. When I double click myscript.ps1, the PowerShell window will open for a very brief period, then close without running. If I move myscript.ps1 to any other location in my C:/ drive, I can double click it and it will run without problems. Also, if I open PowerShell and type C:\Users\<username>\Google Drive\myscript.ps1 it also works without problems. It is just when I double left click within the Google Drive folder that I run into issues. Does anyone know why this is happening? Thanks!

You may want to log out and back into Google Drive/Sync. This happened to me a while back and I am pretty sure that resolved it.

Related

Visual Studio Code terminal displaying "sh-3.2$" every time I "Open in Integrated Terminal" instead of the working directory name (Mac OS)

Earlier today I was having an issue where when I would go to open a new terminal or open a file or folder in Integrated Terminal the terminal would be automatically killed within a couple of seconds without me manually killing it. I was confused as to why this was happening because as far as I could tell I hadn't changed my settings.json file in VS Code or User or Workspace settings and everything was running smoothly just minutes earlier. I was able to resolve that issue but I created a new minor inconvenience. Now whenever I open a file or folder in Integrated terminal it displays "sh-3.2$" instead of the current directory I'm in. If I type pwd and press enter it'll of course display the current directory I'm in but I don't want to have to type that a million times moving forward. If somebody could help me fix this issue I'd greatly appreciate it! I read some of the documentation online but I'm a new bootcamp student and I tried following along but it was going over my head. Thanks again!
I was reading a similar Stack Overflow question and they were saying to try and setup/configure my bash shell to have a prompt with path, specifically the PS1 environment variable, but I was confused on how to actually go about doing that.

Powershell scripts doesnt work when running from specific folder

I have a simple script which only prints "hello" to the screen.
When I run it from my desktop (for example) - it's working
When I run it from a specific folder under, c:\specific_folder it opens the "How do you want to open this file" window and even after I choose "Windows Powershell" it just keep popping up and script never executed..
I'm using Powershell version 5.1
I checked the permissions on folder properties and give everyone a full control but no change..
EDIT:
the script is:
Write-output "Hello"
pause
I run it by double clicking it (manually).
Can you help?
Thanks
If you are double clicking it, it might be executing and instantly closing as the script has finished.
You might want to add something like read-host or sleep(1) to the end just to be able to confirm the script is working

Vbs to run an uninstaller silently or click confirm?

So I have a utility on about 250 computers that is now obsolete. The remote management program I use will not easily let me remove it via the gui. I am no programmer. Not by a long shot. I need a script to run via the remote command prompt to remove the file. I can easily delete the folder it is in but this will leave the registry entry's and thus still list it as installed. I would love to run it 100% silent but if not I at least need the script to confirm when the Uninstall confirm box pops up. I have searched and tried copy and paste with some success. Thanks for any helpful constructive criticism or entire scripts! Haha

Install VSCode in a specific folder

I just downloaded the Visual Studio Code App from https://code.visualstudio.com/ and when I tried to install it, it simply just installed it by itself, without the option to change the installation path.
I have an external harddrive, which is where I want the IDE to be placed instead of the Local Harddrive. How can I change this?
On the VSCode download page select "System Installer" instead of "User Installer". The System installer will prompt you for the install location.
Full credit to Hans Passant for giving the following working solution as a comment.
The installer does very little beyond copying the files, it just creates some Explorer context menu shortcuts ("Open with Code"). Otherwise following Chromium conventions and copying itself to c:\Users\yourname\AppData\Local\Code\app-0.1.0 so it can update itself without you noticing. Boo. So high odds that simply moving that folder to the other drive works just fine, put it anywhere and create a shortcut to Code.exe. If you still want the context menu entry to work then use Regedit and search for "code\app-0.1.0".

Storing code in Google Drive/DropBox

First I understand I should probably be using GitHub or some other online repository, but I would like to explore some of the concepts necessary for my method to work.
I would like to run a batch script/program every time I close Visual Studio, Eclipse, Notepad. Specifically, I would like to run a copy program to copy all of my source code that I generated with that program to a folder inside a Google Drive/Dropbox folder. That way I know it is saved to the cloud. this way I do not have to set up a special backup extension inside each Development enviornment.
Firstly is there a built in simple solution for doing the above? or Do I need to write a custom service that checks to see when those programs are closed? and if that is the way to go where should I look for an example of how to get started?
Thanks.
No, there is no simple built-in method that will backup the files that you want when you want it.
Instead you could simply point your work directories to your Gdrive or DropBox folders, and create a folder inside them for each.
Or you could create a task that copies the files every 10 minutes or however long.
But if you want it to run only when you exit the programs you specify: Yeah, you'll pretty much need to write a batch file for each of the programs you want to back up. Then call the batch file instead of the program.
startVS.bat
set DropBox=C:\Wherever\
start /wait "" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"
xcopy /s /e /d /y "%userprofile%\Documents\Visual Studio 2008\Projects\*.*" "%DropBox%"
If you want to have the same icon, and for the batch file run minimized:
1) Open Windows Explorer, navigate to startVS.bat, right-click on it, and click Create Shortcut.
2) Right-click on startVS - ShortCut -> Click Rename and rename it Visual Studios, then press [ENTER].
3) Right-Click on the new Visual Studios -> Properties -> Change Icon -> Browse
4) Paste %ProgramFiles% (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe into the File Name box.
5) Click Open -> OK
6) Click Normal Window -> Minimized -> OK
7) Put a copy of Visual Studios (really named Visual Studios.lnk) where ever you want it, like in the Start menu.
If you are not running a 64 bit system, at step 4 paste %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe into the File Name box.
I think instead of going for this approach, you can run your script on a timely basis - say every 15 min.
This appraise will have below advantages advantages:
Easy to implement
Tool Independent
Timely Backup
Re-Use
So I think your problem will be solved by this approach.
For Google Drive, I've been messing around with GoogleCL: (I'm on Linux/Crunchbang)
$ sudo apt-get install python-gdata
$ sudo apt-get install googleCL
This'll give you the 'google' command:
$ which google
$ man google
You can upload files:
$ google docs upload foo.txt
(seems to store it as 'foo')
And download it: (in my opinion, syntax is inconsistent)
$ google docs get --title foo
(it won't find foo.txt for some reason)
So far, I'm not that happy with it. I want to encrypt files and park them there,
but it seems to choke on them. I've tried uuencoding them so I can just upload
a text file, but have had inconsistent results on files that aren't all that big
(1.6 Mbytes). Maybe Google doesn't want to deal with files it can't get any search
results out of ? Anyway, maybe Dropbox is better; haven't tried it yet.