How to install Ubuntu on USB Stick

On your article “How to install Ubuntu on USB Stick” dated 12/17/22 you use the example of having a linux system already installed and going into Gpart to temporarily change the flags so that Ubuntu will install on the usb stick. Can this be done if the system already has Win7 on it instead of linux, will these flags on a Win7 machine be able to be changed like the linux system so I can run Ubuntu off of a usb stick?

Also will this method work for other distros also or just Ubuntu based?